1 // Copyright (C) 2016 and later: Unicode, Inc. and others. 2 // License & terms of use: http://www.unicode.org/copyright.html 3 /******************************************************************** 4 * COPYRIGHT: 5 * Copyright (c) 1997-2001, International Business Machines Corporation and 6 * others. All Rights Reserved. 7 ********************************************************************/ 8 /******************************************************************************** 9 * 10 * File NCCBTST.H 11 * 12 * Modification History: 13 * Name Description 14 * Madhu Katragadda creation 15 ********************************************************************************* 16 */ 17 #ifndef _NCCBTST 18 #define _NCCBTST 19 20 #include "unicode/utypes.h" 21 #include "unicode/ucnv.h" 22 23 /* C API TEST FOR CALL BACK ROUTINES OF CODESET CONVERSION COMPONENT */ 24 #include "cintltst.h" 25 26 27 static void TestSkipCallBack(void); 28 static void TestStopCallBack(void); 29 static void TestSubCallBack(void); 30 static void TestSubWithValueCallBack(void); 31 static void TestLegalAndOtherCallBack(void); 32 static void TestSingleByteCallBack(void); 33 34 35 static void TestSkip(int32_t inputsize, int32_t outputsize); 36 37 static void TestStop(int32_t inputsize, int32_t outputsize); 38 39 static void TestSub(int32_t inputsize, int32_t outputsize); 40 41 static void TestSubWithValue(int32_t inputsize, int32_t outputsize); 42 43 static void TestLegalAndOthers(int32_t inputsize, int32_t outputsize); 44 static void TestSingleByte(int32_t inputsize, int32_t outputsize); 45 static void TestEBCDIC_STATEFUL_Sub(int32_t inputsize, int32_t outputsize); 46 47 /* Following will return FALSE *only* on a mismach. They will return TRUE on any other error OR success, because 48 * the error would have been emitted to log_err separately. */ 49 50 UBool testConvertFromUnicode(const UChar *source, int sourceLen, const uint8_t *expect, int expectLen, 51 const char *codepage, UConverterFromUCallback callback, const int32_t *expectOffsets, 52 const char *mySubChar, int8_t len); 53 54 55 UBool testConvertToUnicode( const uint8_t *source, int sourcelen, const UChar *expect, int expectlen, 56 const char *codepage, UConverterToUCallback callback, const int32_t *expectOffsets, 57 const char *mySubChar, int8_t len); 58 59 UBool testConvertFromUnicodeWithContext(const UChar *source, int sourceLen, const uint8_t *expect, int expectLen, 60 const char *codepage, UConverterFromUCallback callback , const int32_t *expectOffsets, 61 const char *mySubChar, int8_t len, const void* context, UErrorCode expectedError); 62 63 UBool testConvertToUnicodeWithContext( const uint8_t *source, int sourcelen, const UChar *expect, int expectlen, 64 const char *codepage, UConverterToUCallback callback, const int32_t *expectOffsets, 65 const char *mySubChar, int8_t len, const void* context, UErrorCode expectedError); 66 67 static void printSeq(const uint8_t* a, int len); 68 static void printUSeq(const UChar* a, int len); 69 static void printSeqErr(const uint8_t* a, int len); 70 static void printUSeqErr(const UChar* a, int len); 71 static void setNuConvTestName(const char *codepage, const char *direction); 72 73 74 #endif 75