summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-03-01 18:52:33 -0500
committerJakob Kaivo <jkk@ung.org>2019-03-01 18:52:33 -0500
commitd5270660952c2cd0456a83a09d55d721798b6e6e (patch)
tree70d65f75c3bfcbb7668904794803b0191a8dd9e6
parentcf342ad275c05edf177206b8931ebca8890f591a (diff)
use defs for locale tests
-rw-r--r--Makefile4
-rw-r--r--locale.c32
-rw-r--r--locale.d7
-rw-r--r--locale.defs1
4 files changed, 11 insertions, 33 deletions
diff --git a/Makefile b/Makefile
index 15b0c0a..3176f97 100644
--- a/Makefile
+++ b/Makefile
@@ -17,10 +17,10 @@ testlibc: $(TESTOBJS) $(LIBDIR)/libc.a
assert.o: assert.c test.h
ctype.o: ctype.c test.h
-locale.o: locale.c test.h
+locale.o: locale.c locale.d test.h
errno.o: errno.c test.h
time.o: time.c test.h
-signal.o: signal.c signal.d
+signal.o: signal.c signal.d test.h
test.o: test.c test.h
main.o: main.c test.h
diff --git a/locale.c b/locale.c
index d95831a..7ae3397 100644
--- a/locale.c
+++ b/locale.c
@@ -2,41 +2,11 @@
#include <limits.h>
#include "test.h"
-#ifndef LC_ALL
-#error LC_ALL not defined
-#endif
-
-#ifndef LC_COLLATE
-#error LC_COLLATE not defined
-#endif
-
-#ifndef LC_CTYPE
-#error LC_CTYPE not defined
-#endif
-
-#ifndef LC_MONETARY
-#error LC_MONETARY not defined
-#endif
-
-#ifndef LC_NUMERIC
-#error LC_NUMERIC not defined
-#endif
-
-#ifndef LC_TIME
-#error LC_TIME not defined
-#endif
+#include "locale.d"
void test_locale_h(void)
{
struct lconv *lc;
- int locale_categories[] = {
- LC_ALL,
- LC_COLLATE,
- LC_CTYPE,
- LC_MONETARY,
- LC_NUMERIC,
- LC_TIME,
- };
testing_header("locale.h");
diff --git a/locale.d b/locale.d
new file mode 100644
index 0000000..49ab136
--- /dev/null
+++ b/locale.d
@@ -0,0 +1,7 @@
+static int locale_categories[] = {
+ LC_ALL,
+ LC_COLLATE,
+ LC_CTYPE,
+ LC_MONETARY,
+ LC_NUMERIC,
+};
diff --git a/locale.defs b/locale.defs
new file mode 100644
index 0000000..2cecc76
--- /dev/null
+++ b/locale.defs
@@ -0,0 +1 @@
+distinct locale_categories LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY LC_NUMERIC LC_TIME