Add missing unit_test.inc file
This commit is contained in:
parent
567f911093
commit
22d994009e
23
unittests/unit_test.inc
Normal file
23
unittests/unit_test.inc
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
def assert_equal(x, y)
|
||||||
|
{
|
||||||
|
if (x == y)
|
||||||
|
{
|
||||||
|
// Passes
|
||||||
|
} else {
|
||||||
|
// Fails
|
||||||
|
print("assert_equal failure: got " + to_string(y) + " expected " + to_string(x));
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def assert_throws(desc, x)
|
||||||
|
{
|
||||||
|
if (throws_exception(x))
|
||||||
|
{
|
||||||
|
// Passes
|
||||||
|
} else {
|
||||||
|
// Fails
|
||||||
|
print("assert_throws failure, function did not throw exception: " + to_string(desc));
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user