]> git.saurik.com Git - apple/icu.git/blob - icuSources/test/intltest/testutil.h
ICU-62135.0.1.tar.gz
[apple/icu.git] / icuSources / test / intltest / testutil.h
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 **********************************************************************
5 * Copyright (C) 2001-2009, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 **********************************************************************
8 * Date Name Description
9 * 05/23/00 aliu Creation.
10 **********************************************************************
11 */
12 #ifndef TESTUTIL_H
13 #define TESTUTIL_H
14
15 #include "unicode/utypes.h"
16 #include "unicode/edits.h"
17 #include "unicode/unistr.h"
18 #include "intltest.h"
19
20 struct EditChange {
21 UBool change;
22 int32_t oldLength, newLength;
23 };
24
25 /**
26 * Utility methods. Everything in this class is static.
27 */
28 class TestUtility {
29 public:
30 static UnicodeString &appendHex(UnicodeString &buf, UChar32 ch);
31
32 static UnicodeString hex(UChar32 ch);
33
34 static UnicodeString hex(const UnicodeString& s);
35
36 static UnicodeString hex(const UnicodeString& s, UChar sep);
37
38 static UnicodeString hex(const uint8_t* bytes, int32_t len);
39
40 static UBool checkEqualEdits(IntlTest &test, const UnicodeString &name,
41 const Edits &e1, const Edits &e2, UErrorCode &errorCode);
42
43 static void checkEditsIter(
44 IntlTest &test, const UnicodeString &name,
45 Edits::Iterator ei1, Edits::Iterator ei2, // two equal iterators
46 const EditChange expected[], int32_t expLength, UBool withUnchanged,
47 UErrorCode &errorCode);
48
49 private:
50 TestUtility() = delete; // Prevent instantiation
51 };
52
53 #endif