[liba] Add test to setjmp longjmp

Change-Id: I6951d7948d8c6a282b16007d6bef448c179f70b8
This commit is contained in:
Émilie Feral
2017-08-23 09:51:04 +02:00
parent e0252c7751
commit b277d86430
2 changed files with 15 additions and 0 deletions

View File

@@ -137,6 +137,7 @@ endif
tests += $(addprefix liba/test/, \
aeabi.c \
ieee754.c \
setjmp.c \
stddef.c \
stdint.c \
strlcpy.c \

14
liba/test/setjmp.c Normal file
View File

@@ -0,0 +1,14 @@
#include <quiz.h>
#include <setjmp.h>
#include <assert.h>
QUIZ_CASE(set_jmp_long_jmp) {
jmp_buf env;
int res = setjmp(env);
if (res == 1) {
return;
}
int newres = (0 == res) ? res : res + 1;
longjmp(env, newres);
assert(false);
}