@@ -38,7 +38,7 @@ stock void SetTestContext(const char[] context)
38
38
strcopy (TestContext, sizeof (TestContext), context);
39
39
}
40
40
41
- stock void AssertEq (const char [] text, int cell1, int cell2)
41
+ stock void AssertEq (const char [] text, any cell1, any cell2)
42
42
{
43
43
TestNumber++ ;
44
44
if (cell1 == cell2)
@@ -52,6 +52,39 @@ stock void AssertEq(const char[] text, int cell1, int cell2)
52
52
}
53
53
}
54
54
55
+ stock void AssertArrayEq (const char [] text, const any[] value, const any[] expected, int len)
56
+ {
57
+ TestNumber++ ;
58
+ for (int i = 0 ; i < len; ++ i)
59
+ {
60
+ if (value[i] != expected[i])
61
+ {
62
+ PrintToServer (" [%d ] %s FAIL: %s should be %d at index %d , got %d " , TestNumber, TestContext, text, expected[i], i, value[i]);
63
+ ThrowError (" test %d (%s in %s ) failed" , TestNumber, text, TestContext);
64
+ break ;
65
+ }
66
+ }
67
+ PrintToServer (" [%d ] %s : '%s ' arrays are equal OK" , TestNumber, TestContext, text);
68
+ }
69
+
70
+ stock void AssertArray2DEq (const char [] text, const any[][] value, const any[][] expected, int len, int innerlen)
71
+ {
72
+ TestNumber++ ;
73
+ for (int i= 0 ; i < len; ++ i)
74
+ {
75
+ for (int j= 0 ; j < innerlen; ++ j)
76
+ {
77
+ if (value[i][j] != expected[i][j])
78
+ {
79
+ PrintToServer (" [%d ] %s FAIL: %s should be %d at index [%d ][%d ], got %d " , TestNumber, TestContext, text, expected[i][j], i, j, value[i][j]);
80
+ ThrowError (" test %d (%s in %s ) failed" , TestNumber, text, TestContext);
81
+ break ;
82
+ }
83
+ }
84
+ }
85
+ PrintToServer (" [%d ] %s : '%s ' 2D arrays are equal OK" , TestNumber, TestContext, text);
86
+ }
87
+
55
88
stock void AssertFalse (const char [] text, bool value)
56
89
{
57
90
TestNumber++ ;
@@ -93,3 +126,18 @@ stock void AssertStrEq(const char[] text, const char[] value, const char[] expec
93
126
ThrowError (" test %d (%s in %s ) failed" , TestNumber, text, TestContext);
94
127
}
95
128
}
129
+
130
+ stock void AssertStrArrayEq (const char [] text, const char [][] value, const char [][] expected, int len)
131
+ {
132
+ TestNumber++ ;
133
+ for (int i = 0 ; i < len; ++ i)
134
+ {
135
+ if (! StrEqual (value[i], expected[i]))
136
+ {
137
+ PrintToServer (" [%d ] %s FAIL: %s should be '%s ' at index %d , got '%s '" , TestNumber, TestContext, text, expected[i], i, value[i]);
138
+ ThrowError (" test %d (%s in %s ) failed" , TestNumber, text, TestContext);
139
+ break ;
140
+ }
141
+ }
142
+ PrintToServer (" [%d ] %s : '%s ' arrays are equal OK" , TestNumber, TestContext, text);
143
+ }
0 commit comments