Home | History | Annotate | Download | only in intltest
      1 /********************************************************************
      2  * COPYRIGHT:
      3  * Copyright (c) 1997-2009, International Business Machines Corporation and
      4  * others. All Rights Reserved.
      5  ********************************************************************/
      6 
      7 #include "unicode/utypes.h"
      8 
      9 #if !UCONFIG_NO_COLLATION
     10 
     11 #ifndef _COLL
     12 #include "unicode/coll.h"
     13 #endif
     14 
     15 #ifndef _TBLCOLL
     16 #include "unicode/tblcoll.h"
     17 #endif
     18 
     19 #ifndef _UNISTR
     20 #include "unicode/unistr.h"
     21 #endif
     22 
     23 #ifndef _SORTKEY
     24 #include "unicode/sortkey.h"
     25 #endif
     26 
     27 #include "lcukocol.h"
     28 
     29 #include "sfwdchit.h"
     30 
     31 LotusCollationKoreanTest::LotusCollationKoreanTest()
     32 : myCollation(0)
     33 {
     34     UErrorCode status = U_ZERO_ERROR;
     35     myCollation = Collator::createInstance("ko_kr", status);
     36     if(U_SUCCESS(status)) {
     37       myCollation->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
     38     } else {
     39       errcheckln(status, "Couldn't instantiate the collator with %s", u_errorName(status));
     40       delete myCollation;
     41       myCollation = 0;
     42     }
     43 
     44 }
     45 
     46 LotusCollationKoreanTest::~LotusCollationKoreanTest()
     47 {
     48     delete myCollation;
     49 }
     50 
     51 const UChar LotusCollationKoreanTest::testSourceCases[][LotusCollationKoreanTest::MAX_TOKEN_LEN] = {
     52     {0xac00, 0}
     53 
     54 };
     55 
     56 const UChar LotusCollationKoreanTest::testTargetCases[][LotusCollationKoreanTest::MAX_TOKEN_LEN] = {
     57     {0xac01, 0}
     58 };
     59 
     60 const Collator::EComparisonResult LotusCollationKoreanTest::results[] = {
     61     Collator::LESS
     62 };
     63 
     64 void LotusCollationKoreanTest::TestTertiary(/* char* par */)
     65 {
     66     int32_t i = 0;
     67     myCollation->setStrength(Collator::TERTIARY);
     68 
     69     for (i = 0; i < 1; i++) {
     70         doTest(myCollation, testSourceCases[i], testTargetCases[i], results[i]);
     71     }
     72 }
     73 
     74 void LotusCollationKoreanTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ )
     75 {
     76     if (exec) logln("TestSuite LotusCollationKoreanTest: ");
     77     if(myCollation) {
     78       switch (index) {
     79           case 0: name = "TestTertiary";  if (exec)   TestTertiary(/* par */); break;
     80           default: name = ""; break;
     81       }
     82     } else {
     83       dataerrln("Class collator not instantiated");
     84       name = "";
     85     }
     86 }
     87 
     88 #endif /* #if !UCONFIG_NO_COLLATION */
     89