1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/******************************************************************** 259d709d503bab6e2b61931737e662dd293b40578ccornelius * Copyright (c) 1997-2013 International Business Machines 385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * Corporation and others. All Rights Reserved. 4ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru ********************************************************************/ 5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/******************************************************************************** 6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* File CAPITEST.H 8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Modification History: 10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Name Description 11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Madhu Katragadda Converted to C 1285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho* Brian Rower Added TestOpenVsOpenRules 13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru********************************************************************************* 14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*//* C API TEST For COLLATOR */ 15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#ifndef _CCOLLAPITST 17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define _CCOLLAPITST 18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 19ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/utypes.h" 20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#if !UCONFIG_NO_COLLATION 22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "cintltst.h" 24ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "callcoll.h" 25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define MAX_TOKEN_LEN 16 26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 29ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * error reporting utility method 30ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru **/ 31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 32ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static void doAssert(int condition, const char *message); 33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Collator Class Properties 35ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * ctor, dtor, createInstance, compare, getStrength/setStrength 36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * getDecomposition/setDecomposition, getDisplayName 37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 38ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void TestProperty(void); 39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Test RuleBasedCollator and getRules 41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru **/ 42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void TestRuleBasedColl(void); 43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 44ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Test compare 46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru **/ 47ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void TestCompare(void); 48ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 49ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Test hashCode functionality 50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru **/ 51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void TestHashCode(void); 52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 53ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Tests the constructor and numerous other methods for CollationKey 54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru **/ 55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void TestSortKey(void); 56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * test the CollationElementIterator methods 58ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru **/ 59ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void TestElemIter(void); 60ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 61ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Test ucol_getAvailable and ucol_countAvailable() 62ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru **/ 63ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void TestGetAll(void); 64ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 65ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Test ucol_GetDefaultRules () 66ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void TestGetDefaultRules(void); 67ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru **/ 68ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 69ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void TestDecomposition(void); 70ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 71ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Test ucol_safeClone () 72ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru **/ 73ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void TestSafeClone(void); 74ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 75ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 76ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Test ucol_cloneBinary(), ucol_openBinary() 77ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru **/ 78ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void TestCloneBinary(void); 79ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 80ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 8185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * Test ucol_open() vs. ucol_openRules() 8285bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho **/ 8385bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho void TestOpenVsOpenRules(void); 8485bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 8585bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /** 86ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Test getting bounds for a sortkey 87ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 88ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void TestBounds(void); 89ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 90ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 91ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Test ucol_getLocale function 92ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 93ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void TestGetLocale(void); 94ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 95ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 96ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Test buffer overrun while having smaller buffer for sortkey (j1865) 97ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 98ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void TestSortKeyBufferOverrun(void); 99ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 100ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Test getting and setting of attributes 101ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 102ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void TestGetSetAttr(void); 103ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 104ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Test getTailoredSet 105ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 106ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void TestGetTailoredSet(void); 107ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 108ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 109ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Test mergeSortKeys 110ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 111ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void TestMergeSortKeys(void); 112ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 113ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 114ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * test short string and collator identifier functions 115ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 116ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static void TestShortString(void); 117ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 118ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 119ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * test getContractions and getUnsafeSet 120ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 121ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static void TestGetContractionsAndUnsafes(void); 122ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 123ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 124ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Test funny stuff with open binary 125ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 126ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru static void TestOpenBinary(void); 12785bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho 12885bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho /** 12985bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho * Test getKeywordValuesForLocale API 13085bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho */ 13185bf2e2fbc60a9f938064abc8127d61da7d19882Claire Ho static void TestGetKeywordValuesForLocale(void); 13259d709d503bab6e2b61931737e662dd293b40578ccornelius 13359d709d503bab6e2b61931737e662dd293b40578ccornelius /** 13459d709d503bab6e2b61931737e662dd293b40578ccornelius * test strcoll with null arg 13559d709d503bab6e2b61931737e662dd293b40578ccornelius */ 13659d709d503bab6e2b61931737e662dd293b40578ccornelius static void TestStrcollNull(void); 13759d709d503bab6e2b61931737e662dd293b40578ccornelius 138ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif /* #if !UCONFIG_NO_COLLATION */ 139ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 140ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif 141