@@ -38,7 +38,7 @@ stock void SetTestContext(const char[] context)
3838 strcopy (TestContext, sizeof (TestContext), context);
3939}
4040
41- stock void AssertEq (const char [] text, int cell1, int cell2)
41+ stock void AssertEq (const char [] text, any cell1, any cell2)
4242{
4343 TestNumber++ ;
4444 if (cell1 == cell2)
@@ -52,6 +52,39 @@ stock void AssertEq(const char[] text, int cell1, int cell2)
5252 }
5353}
5454
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+
5588stock void AssertFalse (const char [] text, bool value)
5689{
5790 TestNumber++ ;
@@ -93,3 +126,18 @@ stock void AssertStrEq(const char[] text, const char[] value, const char[] expec
93126 ThrowError (" test %d (%s in %s ) failed" , TestNumber, text, TestContext);
94127 }
95128}
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