aboutsummaryrefslogtreecommitdiff
path: root/tests/demo.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2016-12-15 22:07:49 -0800
committerGarrett D'Amore <garrett@damore.org>2016-12-15 22:07:49 -0800
commit2fea9b850333d8f48e83fbbd87921f47c1fa8bb5 (patch)
treed92973acba58636f06d644de14ee06954f1768c2 /tests/demo.c
parent474168faf403fc9e9733c7bcb826773dc00eced1 (diff)
downloadnng-2fea9b850333d8f48e83fbbd87921f47c1fa8bb5.tar.gz
nng-2fea9b850333d8f48e83fbbd87921f47c1fa8bb5.tar.bz2
nng-2fea9b850333d8f48e83fbbd87921f47c1fa8bb5.zip
Early test framework, modeled on GoConvey.
Diffstat (limited to 'tests/demo.c')
-rw-r--r--tests/demo.c33
1 files changed, 33 insertions, 0 deletions
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 <stdio.h>
+#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);
+ });
+ });
+});
+})