164339d36f8bd4db5025fe2988eda22b491a9219cFredrik Roubert// Copyright (C) 2016 and later: Unicode, Inc. and others. 264339d36f8bd4db5025fe2988eda22b491a9219cFredrik Roubert// License & terms of use: http://www.unicode.org/copyright.html 3ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru/* 4ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru********************************************************************** 5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Copyright (C) 1999-2003, International Business Machines 6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Corporation and others. All Rights Reserved. 7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru********************************************************************** 8ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* Date Name Description 9ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru* 12/09/99 aliu Ported from Java. 10ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru********************************************************************** 11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru*/ 12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#ifndef COLLATIONTHAITEST_H 14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#define COLLATIONTHAITEST_H 15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "unicode/utypes.h" 17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#if !UCONFIG_NO_COLLATION 19ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#include "tscoll.h" 21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruclass CollationThaiTest : public IntlTestCollator { 23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru Collator* coll; // Thai collator 24ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querupublic: 26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru CollationThaiTest(); 28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru virtual ~CollationThaiTest(); 29ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 30ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void runIndexedTest( int32_t index, UBool exec, const char* &name, char* par = NULL ); 31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 32ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprivate: 33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 35ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Read the external dictionary file, which is already in proper 36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * sorted order, and confirm that the collator compares each line as 37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * preceding the following line. 38ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void TestDictionary(void); 40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Odd corner conditions taken from "How to Sort Thai Without Rewriting Sort", 43ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * by Doug Cooper, http://seasrc.th.net/paper/thaisort.zip 44ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 45ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void TestCornerCases(void); 46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 47ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 48ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Read the external names list, and confirms that the collator 49ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * gets the same results when comparing lines one to another 50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * using regular and iterative comparison. 51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void TestNamesList(void); 53ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * test that invalid Thai sorts properly 56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void TestInvalidThai(void); 58ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 59ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 60ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * test that reording is done properly 61ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 62ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void TestReordering(void); 63ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 64ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruprivate: 65ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 66ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru void compareArray(Collator& c, const char* tests[], 67ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int32_t testsLength); 68ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 69ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru int8_t sign(int32_t i); 70ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 71ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru /** 72ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * Set a UnicodeString corresponding to the given string. Use 73ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * UnicodeString and the default converter, unless we see the sequence 74ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru * "\\u", in which case we interpret the subsequent escape. 75ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru */ 76ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru UnicodeString& parseChars(UnicodeString& result, 77ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru const char* chars); 78ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru}; 79ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 80ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif /* #if !UCONFIG_NO_COLLATION */ 81ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru 82ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#endif 83