|
@@ -17,7 +17,7 @@ static void testAdd(Core::Test& test) {
|
|
|
IntMap map;
|
|
|
test.checkFalse(map.add(5, 4), "add works 1");
|
|
|
int* value = map.search(5);
|
|
|
- test.checkEqual(true, value != nullptr, "contains added value");
|
|
|
+ test.checkTrue(value != nullptr, "contains added value");
|
|
|
if(value != nullptr) {
|
|
|
test.checkEqual(4, *value, "search finds added value");
|
|
|
}
|
|
@@ -28,15 +28,15 @@ static void testMultipleAdd(Core::Test& test) {
|
|
|
test.checkFalse(map.add(5, 4), "add works 2");
|
|
|
test.checkFalse(map.add(10, 3), "add works 3");
|
|
|
test.checkFalse(map.add(15, 2), "add works 4");
|
|
|
- test.checkEqual(true, map.contains(5), "contains added value 1");
|
|
|
- test.checkEqual(true, map.contains(10), "contains added value 2");
|
|
|
- test.checkEqual(true, map.contains(15), "contains added value 3");
|
|
|
+ test.checkTrue(map.contains(5), "contains added value 1");
|
|
|
+ test.checkTrue(map.contains(10), "contains added value 2");
|
|
|
+ test.checkTrue(map.contains(15), "contains added value 3");
|
|
|
int* a = map.search(5);
|
|
|
int* b = map.search(10);
|
|
|
int* c = map.search(15);
|
|
|
- test.checkEqual(true, a != nullptr, "contains added value 1");
|
|
|
- test.checkEqual(true, b != nullptr, "contains added value 2");
|
|
|
- test.checkEqual(true, c != nullptr, "contains added value 3");
|
|
|
+ test.checkTrue(a != nullptr, "contains added value 1");
|
|
|
+ test.checkTrue(b != nullptr, "contains added value 2");
|
|
|
+ test.checkTrue(c != nullptr, "contains added value 3");
|
|
|
if(a != nullptr && b != nullptr && c != nullptr) {
|
|
|
test.checkEqual(4, *a, "search finds added value 1");
|
|
|
test.checkEqual(3, *b, "search finds added value 2");
|
|
@@ -46,17 +46,17 @@ static void testMultipleAdd(Core::Test& test) {
|
|
|
|
|
|
static void testSearch(Core::Test& test) {
|
|
|
IntMap map;
|
|
|
- test.checkEqual(true, nullptr == map.search(6),
|
|
|
- "search does not find missing key");
|
|
|
+ test.checkTrue(nullptr == map.search(6),
|
|
|
+ "search does not find missing key");
|
|
|
}
|
|
|
|
|
|
static void testAddReplace(Core::Test& test) {
|
|
|
IntMap map;
|
|
|
test.checkFalse(map.add(5, 4), "add works 5");
|
|
|
test.checkFalse(map.add(5, 10), "add works 6");
|
|
|
- test.checkEqual(true, map.contains(5), "contains replaced value");
|
|
|
+ test.checkTrue(map.contains(5), "contains replaced value");
|
|
|
int* a = map.search(5);
|
|
|
- test.checkEqual(true, a != nullptr, "contains replaced value");
|
|
|
+ test.checkTrue(a != nullptr, "contains replaced value");
|
|
|
if(a != nullptr) {
|
|
|
test.checkEqual(10, *a, "search finds replaced value");
|
|
|
}
|
|
@@ -67,10 +67,8 @@ static void testClear(Core::Test& test) {
|
|
|
test.checkFalse(map.add(5, 4), "add works 7");
|
|
|
test.checkFalse(map.add(4, 10), "add works 8");
|
|
|
map.clear();
|
|
|
- test.checkEqual(false, map.contains(5),
|
|
|
- "does not contain cleared values 1");
|
|
|
- test.checkEqual(false, map.contains(4),
|
|
|
- "does not contain cleared values 2");
|
|
|
+ test.checkFalse(map.contains(5), "does not contain cleared values 1");
|
|
|
+ test.checkFalse(map.contains(4), "does not contain cleared values 2");
|
|
|
}
|
|
|
|
|
|
static void testOverflow(Core::Test& test) {
|
|
@@ -81,7 +79,6 @@ static void testOverflow(Core::Test& test) {
|
|
|
for(int i = 0; i < 1000000; i++) {
|
|
|
test.checkTrue(map.contains(i), "still contains values after overflow");
|
|
|
}
|
|
|
- test.checkTrue(true, "survives overflow");
|
|
|
}
|
|
|
|
|
|
struct A {
|
|
@@ -121,9 +118,9 @@ static void testEmplace(Core::Test& test) {
|
|
|
A* b = map.search(3);
|
|
|
A* c = map.search(20);
|
|
|
|
|
|
- test.checkEqual(true, a != nullptr, "contains emplaced value 1");
|
|
|
- test.checkEqual(true, b != nullptr, "contains emplaced value 2");
|
|
|
- test.checkEqual(true, c != nullptr, "contains emplaced value 3");
|
|
|
+ test.checkTrue(a != nullptr, "contains emplaced value 1");
|
|
|
+ test.checkTrue(b != nullptr, "contains emplaced value 2");
|
|
|
+ test.checkTrue(c != nullptr, "contains emplaced value 3");
|
|
|
|
|
|
if(a != nullptr && b != nullptr && c != nullptr) {
|
|
|
test.checkEqual(A(3, 4), *a, "contains emplaced value 1");
|
|
@@ -131,11 +128,11 @@ static void testEmplace(Core::Test& test) {
|
|
|
test.checkEqual(A(5, 6), *c, "contains emplaced value 3");
|
|
|
}
|
|
|
|
|
|
- test.checkEqual(false, r1, "emplacing returns correct value 1");
|
|
|
- test.checkEqual(false, r2, "emplacing returns correct value 2");
|
|
|
- test.checkEqual(false, r3, "emplacing returns correct value 3");
|
|
|
- test.checkEqual(true, r4, "emplacing returns correct value 4");
|
|
|
- test.checkEqual(true, r5, "emplacing returns correct value 5");
|
|
|
+ test.checkFalse(r1, "emplacing returns correct value 1");
|
|
|
+ test.checkFalse(r2, "emplacing returns correct value 2");
|
|
|
+ test.checkFalse(r3, "emplacing returns correct value 3");
|
|
|
+ test.checkTrue(r4, "emplacing returns correct value 4");
|
|
|
+ test.checkTrue(r5, "emplacing returns correct value 5");
|
|
|
}
|
|
|
|
|
|
static void testToString1(Core::Test& test) {
|
|
@@ -169,8 +166,8 @@ static void testCopy(Core::Test& test) {
|
|
|
int* a[6] = {map.search(1), map.search(2), map.search(3),
|
|
|
copy.search(1), copy.search(2), copy.search(3)};
|
|
|
for(int i = 0; i < 3; i++) {
|
|
|
- test.checkEqual(true, a[i] != nullptr && a[i + 3] != nullptr,
|
|
|
- "copy has same values");
|
|
|
+ test.checkTrue(a[i] != nullptr && a[i + 3] != nullptr,
|
|
|
+ "copy has same values");
|
|
|
if(a[i] != nullptr && a[i + 3] != nullptr) {
|
|
|
test.checkEqual(*(a[i]), *(a[i + 3]), "copy has same values");
|
|
|
}
|
|
@@ -188,9 +185,9 @@ static void testMove(Core::Test& test) {
|
|
|
int* b = move.search(2);
|
|
|
int* c = move.search(3);
|
|
|
|
|
|
- test.checkEqual(true, a != nullptr, "move moves values 1");
|
|
|
- test.checkEqual(true, b != nullptr, "move moves values 2");
|
|
|
- test.checkEqual(true, c != nullptr, "move moves values 3");
|
|
|
+ test.checkTrue(a != nullptr, "move moves values 1");
|
|
|
+ test.checkTrue(b != nullptr, "move moves values 2");
|
|
|
+ test.checkTrue(c != nullptr, "move moves values 3");
|
|
|
|
|
|
if(a != nullptr && b != nullptr && c != nullptr) {
|
|
|
test.checkEqual(3, *a, "move moves values 1");
|
|
@@ -212,9 +209,9 @@ static void testMoveAssignment(Core::Test& test) {
|
|
|
int* b = move.search(2);
|
|
|
int* c = move.search(3);
|
|
|
|
|
|
- test.checkEqual(true, a != nullptr, "move moves values 1");
|
|
|
- test.checkEqual(true, b != nullptr, "move moves values 2");
|
|
|
- test.checkEqual(true, c != nullptr, "move moves values 3");
|
|
|
+ test.checkTrue(a != nullptr, "move moves values 1");
|
|
|
+ test.checkTrue(b != nullptr, "move moves values 2");
|
|
|
+ test.checkTrue(c != nullptr, "move moves values 3");
|
|
|
|
|
|
if(a != nullptr && b != nullptr && c != nullptr) {
|
|
|
test.checkEqual(3, *a, "move moves values 1");
|
|
@@ -236,12 +233,12 @@ static void testRemove(Core::Test& test) {
|
|
|
int* b = map.search(2);
|
|
|
int* c = map.search(3);
|
|
|
|
|
|
- test.checkEqual(true, a != nullptr, "move moves values 1");
|
|
|
- test.checkEqual(true, b == nullptr, "move moves values 2");
|
|
|
- test.checkEqual(true, c != nullptr, "move moves values 3");
|
|
|
+ test.checkTrue(a != nullptr, "move moves values 1");
|
|
|
+ test.checkTrue(b == nullptr, "move moves values 2");
|
|
|
+ test.checkTrue(c != nullptr, "move moves values 3");
|
|
|
|
|
|
- test.checkEqual(true, remove1, "remove returns true");
|
|
|
- test.checkEqual(false, remove2, "remove returns false");
|
|
|
+ test.checkTrue(remove1, "remove returns true");
|
|
|
+ test.checkFalse(remove2, "remove returns false");
|
|
|
|
|
|
if(a != nullptr && c != nullptr) {
|
|
|
test.checkEqual(3, *a, "move moves values 1");
|