diff options
author | Jakob Kaivo <jkk@ung.org> | 2019-03-01 20:24:54 -0500 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2019-03-01 20:24:54 -0500 |
commit | 9cc79623cc21c52bbf78afdfdbfd8058c5c55af8 (patch) | |
tree | 44cb7b3a8fd33eaca97ddf588ceeb527b30960d4 /setjmp.c | |
parent | add94c7ea454202a01c5feb96c7e9131f82d7a46 (diff) |
<setjmp.h> tests (still disabled until I begin writing the actual code since longjmp() is a _Noreturn function)
Diffstat (limited to 'setjmp.c')
-rw-r--r-- | setjmp.c | 21 |
1 files changed, 21 insertions, 0 deletions
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 <setjmp.h> +#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(); +} |