Closed MaxTymchii closed 3 months ago
UPDATE:
Arrays are working properly with _count
.
function assertEqualArray(actual, expected) {
var message = "";
str::sprintf(message, "Arrays length: actual[%d], expected:[%d]", actual._count, expected._count);
println(message);
if (actual._count != expected._count) {
return false;
}
for (var i = 0; i < actual._count; i++) {
str::sprintf(message, "Index: %d, actual: %d, expected: %d", i, actual[i], expected[i]);
println(message);
if (actual[i] != expected[i]) {
return false;
}
}
return true;
}
Arrays length: actual[4], expected:[4]
Index: 0, actual: 1, expected: 1
Index: 1, actual: 2, expected: 2
Index: 2, actual: 3, expected: 3
Index: 3, actual: 4, expected: 4
PASS: [1, 2, 3, 4] and [1, 2, 3, 4] Arrays are equal
Arrays length: actual[4], expected:[4]
Index: 0, actual: 1, expected: 1
Index: 1, actual: 2, expected: 2
Index: 2, actual: 3, expected: 3
Index: 3, actual: 4, expected: 5
FAIL: [1, 2, 3, 4] and [1, 2, 3, 5] Arrays are NOT equal
Arrays length: actual[4], expected:[5]
FAIL: [1, 2, 3, 4] and [1, 2, 3, 4, 5] Arrays are NOT equal
most of these issues are fixed with the exception of hash size, which is a bit of a hassle.
I am leaving this open until I have a solution to that
hash size now works.
I try to make assert for hash table and here what I get.
Results:
length of each of the tables is not 10 they are 3 or 4!
Also, you can find another buggy thing. If you remove from
for (var key, var value : actual) {
var value
it gonna be a strange behavior with a print.