From 2fea9b850333d8f48e83fbbd87921f47c1fa8bb5 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Thu, 15 Dec 2016 22:07:49 -0800 Subject: Early test framework, modeled on GoConvey. --- tests/demo.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/demo.c (limited to 'tests/demo.c') diff --git a/tests/demo.c b/tests/demo.c new file mode 100644 index 00000000..2b874b9e --- /dev/null +++ b/tests/demo.c @@ -0,0 +1,33 @@ +#include +#include "test.h" + +test_main("Things work", { + int x; + int y; + x = 1; + y = 2; + test_convey("X is one", { + test_assert(x == 1); + }); + test_convey("Y is two", { + test_so(y == 2); + y = 3; + test_so(y == 3); + }); + +test_convey("Bounce", { + test_convey("Arithmetic", { + test_so(y == 2); + test_convey("Addition", { + test_so(x + y == 3); + test_so(x + y + y == 5); + y = 5; + test_so(x + y == 6); + }); + test_convey("Subtraction", { + test_so(x - y == -1); + test_so(y - x == 1); + }); + }); +}); +}) -- cgit v1.2.3-70-g09d2