Gonna start unit testing to resolve issues

This commit is contained in:
2022-08-28 07:03:12 +01:00
parent 9c766ec61e
commit 5300e2ceec
13 changed files with 0 additions and 2 deletions

View File

@@ -0,0 +1,31 @@
//test operators (integers)
assert 1 + 1 == 2, "1 + 1 == 2";
assert 1 - 1 == 0, "1 - 1 == 0";
assert 2 * 2 == 4, "2 * 2 == 4";
assert 1 / 2 == 0, "1 / 2 == 0"; //integer division
assert 5 % 2 == 1, "5 % 2 == 1";
//test operators (floats)
assert 1.0 + 1.0 == 2.0, "1.0 + 1.0 == 2.0";
assert 1.0 - 1.0 == 0.0, "1.0 - 1.0 == 0.0";
assert 2.0 * 2.0 == 4.0, "2.0 * 2.0 == 4.0";
assert 1.0 / 2.0 == 0.5, "1.0 / 2.0 == 0.5";
var a = 10;
a += 20;
a -= 25;
assert a == 5, "+= or -= failed";
a *= 5;
a /= 2;
assert a == 12, "*= or /= failed";
a %= 8;
assert a == 4, "%= failed";
print "All good";