simple tgmath test
authornsz <nsz@port70.net>
Sat, 10 Mar 2012 10:35:49 +0000 (11:35 +0100)
committernsz <nsz@port70.net>
Sat, 10 Mar 2012 10:35:49 +0000 (11:35 +0100)
test/tgmath/Makefile [new file with mode: 0644]
test/tgmath/t.c [new file with mode: 0644]

diff --git a/test/tgmath/Makefile b/test/tgmath/Makefile
new file mode 100644 (file)
index 0000000..b11fcf6
--- /dev/null
@@ -0,0 +1,16 @@
+CFLAGS=-g -Wall -D_GNU_SOURCE -fno-builtin -ffloat-store -std=c99 -I../../include
+LDFLAGS=-g
+
+all: tsystem
+
+clean:
+       rm -f *.o t tsystem
+
+t.o: t.c
+       $(CC) $(CFLAGS) -c -o $@ $<
+
+t: t.o ../../lib/libm.a
+       $(CC) $(LDFLAGS) -o $@ $+
+
+tsystem: t.o
+       $(CC) $(LDFLAGS) -lm -o $@ $<
diff --git a/test/tgmath/t.c b/test/tgmath/t.c
new file mode 100644 (file)
index 0000000..836add5
--- /dev/null
@@ -0,0 +1,26 @@
+#include "tgmath.h"
+#include <stdio.h>
+#include <stdint.h>
+
+
+int main()
+{
+       long double i = sin(1);
+       long double d = sin(1.0);
+       long double f = sin(1.0f);
+       long double l = sin(1.0l);
+
+       long double complex dc = sin(1.0+0*I);
+       long double complex fc = sin(1.0f+0*I);
+       long double complex lc = sin(1.0l+0*I);
+
+       printf("i  %2u %La\n", sizeof sin(1), i);
+       printf("d  %2u %La\n", sizeof sin(1.0), d);
+       printf("f  %2u %La\n", sizeof sin(1.0f), f);
+       printf("l  %2u %La\n", sizeof sin(1.0l), l);
+
+       printf("dc %2u %La %La\n", sizeof sin(1.0+0*I), creall(dc), cimagl(dc));
+       printf("fc %2u %La %La\n", sizeof sin(1.0f+0*I), creall(fc), cimagl(fc));
+       printf("lc %2u %La %La\n", sizeof sin(1.0l+0*I), creall(lc), cimagl(lc));
+       return 0;
+}