summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--errno.c34
-rw-r--r--main.c1
3 files changed, 38 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 156ef2a..3ca5ab2 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/errno.c b/errno.c
new file mode 100644
index 0000000..63e003c
--- /dev/null
+++ b/errno.c
@@ -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();
+}
diff --git a/main.c b/main.c
index be6fc76..665aab2 100644
--- a/main.c
+++ b/main.c
@@ -9,6 +9,7 @@ int main(int argc, char *argv[])
}
}
+ test_errno();
test_ctype();
test_locale();
return 0;