From 71091e109b94a09fc696f1c10be7fdc504a52f2e Mon Sep 17 00:00:00 2001 From: Vladimir Weinstein Date: Wed, 23 Apr 2003 05:39:51 +0000 Subject: [PATCH] ICU-2765 test data separated to calldata.h so that it can easily be used from both cintltst and intltest X-SVN-Rev: 11629 --- icu4c/source/test/cintltst/callcoll.c | 119 ++----------------------- icu4c/source/test/cintltst/calldata.h | 109 ++++++++++++++++++++++ icu4c/source/test/intltest/allcoll.cpp | 7 +- 3 files changed, 116 insertions(+), 119 deletions(-) create mode 100644 icu4c/source/test/cintltst/calldata.h diff --git a/icu4c/source/test/cintltst/callcoll.c b/icu4c/source/test/cintltst/callcoll.c index b9b4768003f..0245f81f2cc 100644 --- a/icu4c/source/test/cintltst/callcoll.c +++ b/icu4c/source/test/cintltst/callcoll.c @@ -36,17 +36,17 @@ #if !UCONFIG_NO_COLLATION -#ifndef INCLUDE_CALLCOLL_C - #include "unicode/ucol.h" #include "unicode/uloc.h" -#include "cstring.h" +#include "unicode/ucoleitr.h" +#include "unicode/ustring.h" + #include "cintltst.h" #include "ccolltst.h" #include "callcoll.h" -#include "unicode/ustring.h" +#include "calldata.h" +#include "cstring.h" #include "cmemory.h" -#include "unicode/ucoleitr.h" #include "ucol_imp.h" /* perform test with strength PRIMARY */ @@ -78,89 +78,7 @@ static void TestSurrogates(void); static void TestInvalidRules(void); -#endif - -const UChar testSourceCases[][16] = { - {0x61, 0x62, 0x27, 0x63, 0}, - {0x63, 0x6f, 0x2d, 0x6f, 0x70, 0}, - {0x61, 0x62, 0}, - {0x61, 0x6d, 0x70, 0x65, 0x72, 0x73, 0x61, 0x64, 0}, - {0x61, 0x6c, 0x6c, 0}, - {0x66, 0x6f, 0x75, 0x72, 0}, - {0x66, 0x69, 0x76, 0x65, 0}, - {0x31, 0}, - {0x31, 0}, - {0x31, 0}, /* 10 */ - {0x32, 0}, - {0x32, 0}, - {0x48, 0x65, 0x6c, 0x6c, 0x6f, 0}, - {0x61, 0x3c, 0x62, 0}, - {0x61, 0x3c, 0x62, 0}, - {0x61, 0x63, 0x63, 0}, - {0x61, 0x63, 0x48, 0x63, 0}, /* simple test */ - {0x70, 0x00EA, 0x63, 0x68, 0x65, 0}, - {0x61, 0x62, 0x63, 0}, - {0x61, 0x62, 0x63, 0}, /* 20 */ - {0x61, 0x62, 0x63, 0}, - {0x61, 0x62, 0x63, 0}, - {0x61, 0x62, 0x63, 0}, - {0x61, 0x00E6, 0x63, 0}, - {0x61, 0x63, 0x48, 0x63, 0}, /* primary test */ - {0x62, 0x6c, 0x61, 0x63, 0x6b, 0}, - {0x66, 0x6f, 0x75, 0x72, 0}, - {0x66, 0x69, 0x76, 0x65, 0}, - {0x31, 0}, - {0x61, 0x62, 0x63, 0}, /* 30 */ - {0x61, 0x62, 0x63, 0}, - {0x61, 0x62, 0x63, 0x48, 0}, - {0x61, 0x62, 0x63, 0}, - {0x61, 0x63, 0x48, 0x63, 0}, /* 34 */ - {0x61, 0x63, 0x65, 0x30}, - {0x31, 0x30}, - {0x70, 0x00EA,0x30} /* 37 */ -}; - -const UChar testTargetCases[][16] = { - {0x61, 0x62, 0x63, 0x27, 0}, - {0x43, 0x4f, 0x4f, 0x50, 0}, - {0x61, 0x62, 0x63, 0}, - {0x26, 0}, - {0x26, 0}, - {0x34, 0}, - {0x35, 0}, - {0x6f, 0x6e, 0x65, 0}, - {0x6e, 0x6e, 0x65, 0}, - {0x70, 0x6e, 0x65, 0}, /* 10 */ - {0x74, 0x77, 0x6f, 0}, - {0x75, 0x77, 0x6f, 0}, - {0x68, 0x65, 0x6c, 0x6c, 0x4f, 0}, - {0x61, 0x3c, 0x3d, 0x62, 0}, - {0x61, 0x62, 0x63, 0}, - {0x61, 0x43, 0x48, 0x63, 0}, - {0x61, 0x43, 0x48, 0x63, 0}, /* simple test */ - {0x70, (UChar)0x00E9, 0x63, 0x68, 0x00E9, 0}, - {0x61, 0x62, 0x63, 0}, - {0x61, 0x42, 0x43, 0}, /* 20 */ - {0x61, 0x62, 0x63, 0x68, 0}, - {0x61, 0x62, 0x64, 0}, - {(UChar)0x00E4, 0x62, 0x63, 0}, - {0x61, (UChar)0x00C6, 0x63, 0}, - {0x61, 0x43, 0x48, 0x63, 0}, /* primary test */ - {0x62, 0x6c, 0x61, 0x63, 0x6b, 0x2d, 0x62, 0x69, 0x72, 0x64, 0}, - {0x34, 0}, - {0x35, 0}, - {0x6f, 0x6e, 0x65, 0}, - {0x61, 0x62, 0x63, 0}, - {0x61, 0x42, 0x63, 0}, /* 30 */ - {0x61, 0x62, 0x63, 0x68, 0}, - {0x61, 0x62, 0x64, 0}, - {0x61, 0x43, 0x48, 0x63, 0}, /* 34 */ - {0x61, 0x63, 0x65, 0x30}, - {0x31, 0x30}, - {0x70, (UChar)0x00EB,0x30} /* 37 */ -}; - -#ifndef INCLUDE_CALLCOLL_C +static void TestJitterbug1098(void); const UCollationResult results[] = { UCOL_LESS, @@ -204,30 +122,6 @@ const UCollationResult results[] = { UCOL_LESS /* 37 */ }; -#endif - -const UChar testCases[][4] = -{ - {0x61, 0}, - {0x41, 0}, - {0x00e4, 0}, - {0x00c4, 0}, - {0x61, 0x65, 0}, - {0x61, 0x45, 0}, - {0x41, 0x65, 0}, - {0x41, 0x45, 0}, - {(UChar)0x00e6, 0}, - {(UChar)0x00c6, 0}, - {0x62, 0}, - {0x63, 0}, - {0x7a, 0} -}; - -#define COUNT_TEST_CASES 13 - -#ifndef INCLUDE_CALLCOLL_C - -static void TestJitterbug1098(void); void addAllCollTest(TestNode** root) { @@ -974,6 +868,5 @@ TestJitterbug1098(){ } } -#endif #endif /* #if !UCONFIG_NO_COLLATION */ diff --git a/icu4c/source/test/cintltst/calldata.h b/icu4c/source/test/cintltst/calldata.h new file mode 100644 index 00000000000..f5042d7e9b3 --- /dev/null +++ b/icu4c/source/test/cintltst/calldata.h @@ -0,0 +1,109 @@ +/******************************************************************** + * COPYRIGHT: + * Copyright (c) 1997-2001, International Business Machines Corporation and + * others. All Rights Reserved. + ********************************************************************/ + +#ifndef COLLATION_TEST_DATA +#define COLLATION_TEST_DATA + +#define COUNT_TEST_CASES 13 + +const UChar testSourceCases[][16] = { + {0x61, 0x62, 0x27, 0x63, 0}, + {0x63, 0x6f, 0x2d, 0x6f, 0x70, 0}, + {0x61, 0x62, 0}, + {0x61, 0x6d, 0x70, 0x65, 0x72, 0x73, 0x61, 0x64, 0}, + {0x61, 0x6c, 0x6c, 0}, + {0x66, 0x6f, 0x75, 0x72, 0}, + {0x66, 0x69, 0x76, 0x65, 0}, + {0x31, 0}, + {0x31, 0}, + {0x31, 0}, /* 10 */ + {0x32, 0}, + {0x32, 0}, + {0x48, 0x65, 0x6c, 0x6c, 0x6f, 0}, + {0x61, 0x3c, 0x62, 0}, + {0x61, 0x3c, 0x62, 0}, + {0x61, 0x63, 0x63, 0}, + {0x61, 0x63, 0x48, 0x63, 0}, /* simple test */ + {0x70, 0x00EA, 0x63, 0x68, 0x65, 0}, + {0x61, 0x62, 0x63, 0}, + {0x61, 0x62, 0x63, 0}, /* 20 */ + {0x61, 0x62, 0x63, 0}, + {0x61, 0x62, 0x63, 0}, + {0x61, 0x62, 0x63, 0}, + {0x61, 0x00E6, 0x63, 0}, + {0x61, 0x63, 0x48, 0x63, 0}, /* primary test */ + {0x62, 0x6c, 0x61, 0x63, 0x6b, 0}, + {0x66, 0x6f, 0x75, 0x72, 0}, + {0x66, 0x69, 0x76, 0x65, 0}, + {0x31, 0}, + {0x61, 0x62, 0x63, 0}, /* 30 */ + {0x61, 0x62, 0x63, 0}, + {0x61, 0x62, 0x63, 0x48, 0}, + {0x61, 0x62, 0x63, 0}, + {0x61, 0x63, 0x48, 0x63, 0}, /* 34 */ + {0x61, 0x63, 0x65, 0x30}, + {0x31, 0x30}, + {0x70, 0x00EA,0x30} /* 37 */ +}; + +const UChar testTargetCases[][16] = { + {0x61, 0x62, 0x63, 0x27, 0}, + {0x43, 0x4f, 0x4f, 0x50, 0}, + {0x61, 0x62, 0x63, 0}, + {0x26, 0}, + {0x26, 0}, + {0x34, 0}, + {0x35, 0}, + {0x6f, 0x6e, 0x65, 0}, + {0x6e, 0x6e, 0x65, 0}, + {0x70, 0x6e, 0x65, 0}, /* 10 */ + {0x74, 0x77, 0x6f, 0}, + {0x75, 0x77, 0x6f, 0}, + {0x68, 0x65, 0x6c, 0x6c, 0x4f, 0}, + {0x61, 0x3c, 0x3d, 0x62, 0}, + {0x61, 0x62, 0x63, 0}, + {0x61, 0x43, 0x48, 0x63, 0}, + {0x61, 0x43, 0x48, 0x63, 0}, /* simple test */ + {0x70, (UChar)0x00E9, 0x63, 0x68, 0x00E9, 0}, + {0x61, 0x62, 0x63, 0}, + {0x61, 0x42, 0x43, 0}, /* 20 */ + {0x61, 0x62, 0x63, 0x68, 0}, + {0x61, 0x62, 0x64, 0}, + {(UChar)0x00E4, 0x62, 0x63, 0}, + {0x61, (UChar)0x00C6, 0x63, 0}, + {0x61, 0x43, 0x48, 0x63, 0}, /* primary test */ + {0x62, 0x6c, 0x61, 0x63, 0x6b, 0x2d, 0x62, 0x69, 0x72, 0x64, 0}, + {0x34, 0}, + {0x35, 0}, + {0x6f, 0x6e, 0x65, 0}, + {0x61, 0x62, 0x63, 0}, + {0x61, 0x42, 0x63, 0}, /* 30 */ + {0x61, 0x62, 0x63, 0x68, 0}, + {0x61, 0x62, 0x64, 0}, + {0x61, 0x43, 0x48, 0x63, 0}, /* 34 */ + {0x61, 0x63, 0x65, 0x30}, + {0x31, 0x30}, + {0x70, (UChar)0x00EB,0x30} /* 37 */ +}; + +const UChar testCases[][4] = +{ + {0x61, 0}, + {0x41, 0}, + {0x00e4, 0}, + {0x00c4, 0}, + {0x61, 0x65, 0}, + {0x61, 0x45, 0}, + {0x41, 0x65, 0}, + {0x41, 0x45, 0}, + {(UChar)0x00e6, 0}, + {(UChar)0x00c6, 0}, + {0x62, 0}, + {0x63, 0}, + {0x7a, 0} +}; + +#endif /* #ifndef COLLATION_TEST_DATA */ diff --git a/icu4c/source/test/intltest/allcoll.cpp b/icu4c/source/test/intltest/allcoll.cpp index afe39b358f4..20628550db7 100644 --- a/icu4c/source/test/intltest/allcoll.cpp +++ b/icu4c/source/test/intltest/allcoll.cpp @@ -14,13 +14,8 @@ #include "unicode/sortkey.h" #include "allcoll.h" #include "sfwdchit.h" +#include "../cintltst/calldata.h" -/* - * Include callcoll.c to get the test data. - * This helps maintain a single copy of the data. - */ -#define INCLUDE_CALLCOLL_C -#include "../cintltst/callcoll.c" CollationDummyTest::CollationDummyTest() : myCollation(0)