aboutsummaryrefslogtreecommitdiff
path: root/tests/demo.c
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2016-12-18 21:31:43 -0800
committerGarrett D'Amore <garrett@damore.org>2016-12-18 21:31:43 -0800
commit99dcb2df6ee30004b9fbac1cc2360c6e627dc449 (patch)
treee2092158c1ab3f62881c66a9e5d3b66d742fa755 /tests/demo.c
parent260ce618d98c9ec732362ab82b2efeb2c412ac24 (diff)
downloadnng-99dcb2df6ee30004b9fbac1cc2360c6e627dc449.tar.gz
nng-99dcb2df6ee30004b9fbac1cc2360c6e627dc449.tar.bz2
nng-99dcb2df6ee30004b9fbac1cc2360c6e627dc449.zip
Added support for test_reset(), better than cleanup or other hacks.
Diffstat (limited to 'tests/demo.c')
-rw-r--r--tests/demo.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/demo.c b/tests/demo.c
index 9ff70727..e831109a 100644
--- a/tests/demo.c
+++ b/tests/demo.c
@@ -62,4 +62,33 @@ test_main_group({
test_so(x == 1);
});
});
+
+ test_group("Reset group", {
+ static int x = 0;
+ static int y = 0;
+ test_reset({
+ x = 20;
+ });
+ test_convey("Add one to both y and x", {
+ x++;
+ y++;
+ test_so(x == 1); /* no reset yet */
+ test_so(y == 1);
+ });
+ test_convey("Again", {
+ x++;
+ y++;
+ test_so(x == 21);
+ test_so(y == 2);
+ });
+ test_convey("Third time", {
+ x++;
+ y++;
+ test_so(x == 21);
+ test_so(y == 3);
+ });
+
+ test_so(x == 20);
+ test_so(y == 3);
+ });
})