2 *******************************************************************************
4 * Copyright (C) 2003, International Business Machines
5 * Corporation and others. All Rights Reserved.
7 *******************************************************************************
8 * file name: convtest.h
10 * tab size: 8 (not used)
13 * created on: 2003jul15
14 * created by: Markus W. Scherer
16 * Test file for data-driven conversion tests.
19 #ifndef __CONVTEST_H__
20 #define __CONVTEST_H__
22 #include "unicode/utypes.h"
24 #if !UCONFIG_NO_LEGACY_CONVERSION
26 #include "unicode/ucnv.h"
29 struct ConversionCase
{
31 const char *charset
, *cbopt
, *name
;
37 int32_t unicodeLength
;
38 const int32_t *offsets
;
42 UErrorCode outErrorCode
;
43 const uint8_t *invalidChars
;
44 const UChar
*invalidUChars
;
45 int32_t invalidLength
;
47 uint8_t resultBytes
[200];
48 UChar resultUnicode
[200];
49 int32_t resultOffsets
[200];
52 UErrorCode resultErrorCode
;
55 class ConversionTest
: public IntlTest
{
58 virtual ~ConversionTest();
60 void runIndexedTest(int32_t index
, UBool exec
, const char *&name
, char *par
=0);
63 void TestFromUnicode();
64 void TestGetUnicodeSet();
68 ToUnicodeCase(ConversionCase
&cc
, UConverterToUCallback callback
, const char *option
);
71 FromUnicodeCase(ConversionCase
&cc
, UConverterFromUCallback callback
, const char *option
);
74 checkToUnicode(ConversionCase
&cc
, UConverter
*cnv
, const char *name
,
75 const UChar
*result
, int32_t resultLength
,
76 const int32_t *resultOffsets
,
77 UErrorCode resultErrorCode
);
80 checkFromUnicode(ConversionCase
&cc
, UConverter
*cnv
, const char *name
,
81 const uint8_t *result
, int32_t resultLength
,
82 const int32_t *resultOffsets
,
83 UErrorCode resultErrorCode
);
86 cnv_open(const char *name
, UErrorCode
&errorCode
);
89 #endif /* #if !UCONFIG_NO_LEGACY_CONVERSION */