From 545e51be154967ab3e8d82fff5f7c25487076e72 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 23 Jan 2003 16:28:10 +0000 Subject: Update tests to be somewhat consistant with the rest of the world --- test/math/.cvsignore | 4 ++++ test/math/Makefile | 37 ++++++++++++++++++++++++++++++++++--- test/math/rint.c | 11 +++++++++++ 3 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 test/math/rint.c (limited to 'test/math') diff --git a/test/math/.cvsignore b/test/math/.cvsignore index 31ed5f055..3c0a8a6fc 100644 --- a/test/math/.cvsignore +++ b/test/math/.cvsignore @@ -6,3 +6,7 @@ test-float test-ifloat test-ldouble test-ildouble +rint +rint.out +rint_glibc +rint_glibc.out diff --git a/test/math/Makefile b/test/math/Makefile index d41074939..c9231c5fc 100644 --- a/test/math/Makefile +++ b/test/math/Makefile @@ -25,8 +25,9 @@ EXTRA_LIBS=-lm PERL=/usr/bin/perl TARGETS:= -libm-tests:= +libm-tests=libm-test.c libm-tests+= test-double test-idouble +libm-tests+= diff #libm-tests+= test-float test-ifloat #libm-tests+= test-ldouble test-ildouble libm-tests.o = $(addsuffix .o,$(libm-tests)) @@ -35,7 +36,7 @@ libm-tests-generated = libm-test-ulps.h libm-test.c generated += $(libm-tests-generated) libm-test.stmp TARGETS += $(libm-tests) #$(libm-tests-generated) -all: libm-test.c $(TARGETS) +all: $(TARGETS) test-double: test-double.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) @@ -56,6 +57,36 @@ test-ildouble: test-ildoubl.o $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) -./$@ +rint: rint.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak $(CC) + -@ echo "-------" + -@ echo " " + -@ echo "Compiling vs uClibc: " + -@ echo " " + $(CC) $(CFLAGS) -c $< -o $@.o + $(CC) $(LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) + $(STRIPTOOL) -x -R .note -R .comment $@ + -./$@ > $@.out 2>&1 + -@ echo " " + +rint_glibc: rint.c Makefile $(TESTDIR)/Config $(TESTDIR)/Rules.mak $(CC) + -@ echo "-------" + -@ echo " " + -@ echo "Compiling vs glibc: " + -@ echo " " + $(HOSTCC) $(GLIBC_CFLAGS) -c $< -o $@.o + $(HOSTCC) $(GLIBC_LDFLAGS) $@.o -o $@ $(EXTRA_LIBS) + $(STRIPTOOL) -x -R .note -R .comment $@ + -./$@ > $@.out 2>&1 + -@ echo " " + +diff: rint_glibc rint + -@ echo "-------" + -@ echo " " + -@ echo "Diffing output: " + -@ echo " " + -diff -u rint_glibc.out rint.out + -@ echo " " + test-float.o: libm-test.c test-ifloat.o: libm-test.c test-double.o: libm-test.c @@ -69,6 +100,6 @@ libm-test.c: $(ulps-file) libm-test.inc gen-libm-test.pl $(PERL) ./gen-libm-test.pl -u $< ./libm-test.inc -o "." 2>&1 > /dev/null clean: - rm -f *.[oa] *~ core $(TARGETS) $(generated) + rm -f *.[oa] *~ core $(TARGETS) $(generated) rint_glibc.out rint.out diff --git a/test/math/rint.c b/test/math/rint.c new file mode 100644 index 000000000..399fb90e3 --- /dev/null +++ b/test/math/rint.c @@ -0,0 +1,11 @@ +#include +#include +#include + +int main(void) { + double d1, d2; + d1 = 0.6; d2 = rint(d1); + printf("d1 = %f, d2 = %f\n", d1, d2); + return 0; +} + -- cgit v1.2.3