|
@@ -222,18 +222,6 @@ static void testClear8() {
|
|
|
CORE_TEST_EQUAL(build("wusi1234"), s);
|
|
|
}
|
|
|
|
|
|
-static void testHashCode8() {
|
|
|
- String8 s;
|
|
|
- CORE_TEST_ERROR(s.append("a"));
|
|
|
- CORE_TEST_ERROR(s.append("bc"));
|
|
|
- CORE_TEST_ERROR(s.append(20));
|
|
|
- CORE_TEST_ERROR(s.append(25.5f));
|
|
|
- CORE_TEST_ERROR(s.append(true));
|
|
|
- CORE_TEST_EQUAL(build("abc2025.50true").hashCode(), s.hashCode());
|
|
|
- s.clear();
|
|
|
- CORE_TEST_EQUAL(String8().hashCode(), s.hashCode());
|
|
|
-}
|
|
|
-
|
|
|
static void testAddSelf8() {
|
|
|
String8 s;
|
|
|
CORE_TEST_ERROR(s.append("test1"));
|
|
@@ -242,29 +230,6 @@ static void testAddSelf8() {
|
|
|
CORE_TEST_EQUAL(build("test1test1test1test1"), s);
|
|
|
}
|
|
|
|
|
|
-static void testAsHashMapKey8() {
|
|
|
- Core::HashMap<String8, int> map;
|
|
|
- CORE_TEST_ERROR(map.add(build("wusi"), 3));
|
|
|
- CORE_TEST_ERROR(map.add(build("hiThere"), 7));
|
|
|
- CORE_TEST_ERROR(map.add(build("baum123"), 5));
|
|
|
-
|
|
|
- int* a = map.search(build("wusi"));
|
|
|
- int* b = map.search(build("hiThere"));
|
|
|
- int* c = map.search(build("baum123"));
|
|
|
- int* d = map.search(build("423hifd"));
|
|
|
-
|
|
|
- CORE_TEST_NOT_NULL(a);
|
|
|
- CORE_TEST_NOT_NULL(b);
|
|
|
- CORE_TEST_NOT_NULL(c);
|
|
|
- CORE_TEST_NULL(d);
|
|
|
-
|
|
|
- if(a != nullptr && b != nullptr && c != nullptr) {
|
|
|
- CORE_TEST_EQUAL(3, *a);
|
|
|
- CORE_TEST_EQUAL(7, *b);
|
|
|
- CORE_TEST_EQUAL(5, *c);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
static void testStartsWith8() {
|
|
|
String8 s;
|
|
|
CORE_TEST_ERROR(s.append("0123456789"));
|
|
@@ -410,14 +375,8 @@ static void testReplace8() {
|
|
|
|
|
|
String8 replace;
|
|
|
CORE_TEST_ERROR(replace.append("ABCD"));
|
|
|
-
|
|
|
CORE_TEST_ERROR(s.replace(search, replace));
|
|
|
-
|
|
|
CORE_TEST_STRING("0ABCDABCDä1üABCD3ä", s);
|
|
|
-
|
|
|
- String8 s2;
|
|
|
- CORE_TEST_ERROR(s2.append("0ABCDABCDä1üABCD3ä"));
|
|
|
- CORE_TEST_EQUAL(s2.hashCode(), s.hashCode());
|
|
|
}
|
|
|
|
|
|
static void testReplaceChar8() {
|
|
@@ -433,10 +392,6 @@ static void testReplaceChar8() {
|
|
|
CORE_TEST_STRING("ABCDD3D", s);
|
|
|
s.replace('3', 'E');
|
|
|
CORE_TEST_STRING("ABCDDED", s);
|
|
|
-
|
|
|
- String8 s2;
|
|
|
- CORE_TEST_ERROR(s2.append("ABCDDED"));
|
|
|
- CORE_TEST_EQUAL(s2.hashCode(), s.hashCode());
|
|
|
}
|
|
|
|
|
|
static void testCastAppendSelf8() {
|
|
@@ -704,18 +659,6 @@ static void testClear32() {
|
|
|
CORE_TEST_EQUAL(build(U"wusi1234"), s);
|
|
|
}
|
|
|
|
|
|
-static void testHashCode32() {
|
|
|
- String32 s;
|
|
|
- CORE_TEST_ERROR(s.append(U"a"));
|
|
|
- CORE_TEST_ERROR(s.append(U"bc"));
|
|
|
- CORE_TEST_ERROR(s.append(20));
|
|
|
- CORE_TEST_ERROR(s.append(25.5f));
|
|
|
- CORE_TEST_ERROR(s.append(true));
|
|
|
- CORE_TEST_EQUAL(build(U"abc2025.50true").hashCode(), s.hashCode());
|
|
|
- s.clear();
|
|
|
- CORE_TEST_EQUAL(String32().hashCode(), s.hashCode());
|
|
|
-}
|
|
|
-
|
|
|
static void testAddSelf32() {
|
|
|
String32 s;
|
|
|
CORE_TEST_ERROR(s.append(U"test1"));
|
|
@@ -724,29 +667,6 @@ static void testAddSelf32() {
|
|
|
CORE_TEST_EQUAL(build(U"test1test1test1test1"), s);
|
|
|
}
|
|
|
|
|
|
-static void testAsHashMapKey32() {
|
|
|
- Core::HashMap<String32, int> map;
|
|
|
- CORE_TEST_ERROR(map.add(build(U"wusi"), 3));
|
|
|
- CORE_TEST_ERROR(map.add(build(U"hiThere"), 7));
|
|
|
- CORE_TEST_ERROR(map.add(build(U"baum123"), 5));
|
|
|
-
|
|
|
- int* a = map.search(build(U"wusi"));
|
|
|
- int* b = map.search(build(U"hiThere"));
|
|
|
- int* c = map.search(build(U"baum123"));
|
|
|
- int* d = map.search(build(U"423hifd"));
|
|
|
-
|
|
|
- CORE_TEST_NOT_NULL(a);
|
|
|
- CORE_TEST_NOT_NULL(b);
|
|
|
- CORE_TEST_NOT_NULL(c);
|
|
|
- CORE_TEST_NULL(d);
|
|
|
-
|
|
|
- if(a != nullptr && b != nullptr && c != nullptr) {
|
|
|
- CORE_TEST_EQUAL(3, *a);
|
|
|
- CORE_TEST_EQUAL(7, *b);
|
|
|
- CORE_TEST_EQUAL(5, *c);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
static void testStartsWith32() {
|
|
|
String32 s;
|
|
|
CORE_TEST_ERROR(s.append(U"0123456789"));
|
|
@@ -903,14 +823,8 @@ static void testReplace32() {
|
|
|
|
|
|
String32 replace;
|
|
|
CORE_TEST_ERROR(replace.append(U"ABCD"));
|
|
|
-
|
|
|
CORE_TEST_ERROR(s.replace(search, replace));
|
|
|
-
|
|
|
CORE_TEST_STRING(U"0ABCDABCDä1üABCD3ä", s);
|
|
|
-
|
|
|
- String32 s2;
|
|
|
- CORE_TEST_ERROR(s2.append(U"0ABCDABCDä1üABCD3ä"));
|
|
|
- CORE_TEST_EQUAL(s2.hashCode(), s.hashCode());
|
|
|
}
|
|
|
|
|
|
static void testReplaceChar32() {
|
|
@@ -926,10 +840,6 @@ static void testReplaceChar32() {
|
|
|
CORE_TEST_STRING(U"ABCDD3D", s);
|
|
|
s.replace(U'3', U'E');
|
|
|
CORE_TEST_STRING(U"ABCDDED", s);
|
|
|
-
|
|
|
- String32 s2;
|
|
|
- CORE_TEST_ERROR(s2.append(U"ABCDDED"));
|
|
|
- CORE_TEST_EQUAL(s2.hashCode(), s.hashCode());
|
|
|
}
|
|
|
|
|
|
static void testCastAppendSelf32() {
|
|
@@ -1043,9 +953,7 @@ void Core::testArrayString() {
|
|
|
testIntOverflow8();
|
|
|
testUnicode8();
|
|
|
testClear8();
|
|
|
- testHashCode8();
|
|
|
testAddSelf8();
|
|
|
- testAsHashMapKey8();
|
|
|
testStartsWith8();
|
|
|
testSearch8();
|
|
|
testContains8();
|
|
@@ -1087,9 +995,7 @@ void Core::testArrayString() {
|
|
|
testIntOverflow32();
|
|
|
testUnicode32();
|
|
|
testClear32();
|
|
|
- testHashCode32();
|
|
|
testAddSelf32();
|
|
|
- testAsHashMapKey32();
|
|
|
testStartsWith32();
|
|
|
testSearch32();
|
|
|
testContains32();
|