aboutsummaryrefslogtreecommitdiff
path: root/utest/utest-test.c
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2023-07-22 03:03:09 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2023-07-22 03:03:09 +0300
commitcb1a40859029f33184355475e51fec95afb79a73 (patch)
tree5aea859d3a3e10ddd058beac9d6734d17979d560 /utest/utest-test.c
downloadc-wares-cb1a40859029f33184355475e51fec95afb79a73.tar.gz
c-wares-cb1a40859029f33184355475e51fec95afb79a73.zip
init
Just some C wares; hmap, list, optional, unit tests.
Diffstat (limited to 'utest/utest-test.c')
-rw-r--r--utest/utest-test.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/utest/utest-test.c b/utest/utest-test.c
new file mode 100644
index 0000000..591ee32
--- /dev/null
+++ b/utest/utest-test.c
@@ -0,0 +1,34 @@
+#include "utest.h"
+
+static int a, b;
+
+/* This should pass */
+TEST_BEGIN(test_pass)
+{
+ asserteq(a, 0);
+ assertneq(a, b);
+ expect(b > a, "expected b > a");
+ TEST_OUT
+}
+TEST_END
+
+/* This should fail */
+TEST_BEGIN(test_fail)
+{
+ expect(0, "oopsie!");
+ TEST_OUT
+}
+TEST_END
+
+void test_init(void)
+{
+ a = 0, b = 1;
+ printf("hello, world!\n\n");
+}
+
+void test_destroy(void)
+{
+ printf("\ngood bye!\n");
+}
+
+RUN_TEST_SUITE(test_init, test_destroy, test_pass, test_fail);