diff options
author | Jakob Kaivo <jkk@ung.org> | 2019-02-28 19:19:40 -0500 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2019-02-28 19:19:40 -0500 |
commit | fde01d16193b2d7e5b9482bcc97be9450878afab (patch) | |
tree | 8639a9e9e6b2c714b6c49606f6d4147b6fd6f32f | |
parent | 7eecacb007bf27e9ff31646a6e0a1d7bce51d4a7 (diff) |
initial test for errno
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | errno.c | 34 | ||||
-rw-r--r-- | main.c | 1 |
3 files changed, 38 insertions, 1 deletions
@@ -5,7 +5,7 @@ include config.mk CFLAGS=-g -I$(INCLUDEDIR) -nostdinc -fno-builtin LDFLAGS=-L$(LIBDIR) $(LIBS) -TESTOBJS=main.o test.o assert.o ctype.o locale.o +TESTOBJS=main.o test.o assert.o ctype.o locale.o errno.o testlibc: $(TESTOBJS) $(LIBDIR)/libc.a $(CC) -o $@ $(TESTOBJS) $(LDFLAGS) @@ -16,6 +16,8 @@ ctype.o: ctype.c test.h locale.o: locale.c test.h +errno.o: errno.c test.h + test.o: test.c test.h main.o: main.c test.h @@ -0,0 +1,34 @@ +#include <errno.h> +#include "test.h" + +#ifndef EDOM +#error EDOM not defined +#endif + +#ifndef ERANGE +#error ERANGE not defined +#endif + +#if __STDC_VERSION__ >= 199409 +#ifndef EILSEQ +#error EILSEQ not defined +#endif +#endif + +void test_errno(void) +{ + struct lconv *lc; + int errno_values[] = { + EDOM, + ERANGE, + #ifdef EILSEQ + EILSEQ, + #endif + }; + + testing_header("errno.h"); + + test_distinct(errno_values); + + testing_end(); +} @@ -9,6 +9,7 @@ int main(int argc, char *argv[]) } } + test_errno(); test_ctype(); test_locale(); return 0; |