From 9cc79623cc21c52bbf78afdfdbfd8058c5c55af8 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Fri, 1 Mar 2019 20:24:54 -0500 Subject: tests (still disabled until I begin writing the actual code since longjmp() is a _Noreturn function) --- setjmp.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 setjmp.c (limited to 'setjmp.c') diff --git a/setjmp.c b/setjmp.c new file mode 100644 index 0000000..73f7efc --- /dev/null +++ b/setjmp.c @@ -0,0 +1,21 @@ +#include +#include "test.h" + +void test_setjmp_h(void) +{ + jmp_buf jb; + int r; + int expected = 0; + + testing_header("setjmp.h"); + + r = setjmp(jb); + test_int_equals(r, expected); + + if (r == 0) { + expected = 1; + longjmp(jb, 1); + } + + testing_end(); +} -- cgit v1.2.1