summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjofret2007-04-20 08:32:26 +0000
committerjofret2007-04-20 08:32:26 +0000
commit1f59e1352536bce4c7a9b30a81c84a219efdfe1f (patch)
tree1f8a4af181a93bfa637cde184029628b38e6160e
parent8ebfecf1369d949014e715c98458d6961046084d (diff)
downloadscilab2c-1f59e1352536bce4c7a9b30a81c84a219efdfe1f.tar.gz
scilab2c-1f59e1352536bce4c7a9b30a81c84a219efdfe1f.tar.bz2
scilab2c-1f59e1352536bce4c7a9b30a81c84a219efdfe1f.zip
Adding Automated tests.
-rw-r--r--src/elementaryFunctions/exp/Makefile.am20
-rw-r--r--src/elementaryFunctions/exp/Makefile.in138
-rw-r--r--src/elementaryFunctions/exp/testExp.c66
-rw-r--r--src/elementaryFunctions/exp/testExp.h40
4 files changed, 253 insertions, 11 deletions
diff --git a/src/elementaryFunctions/exp/Makefile.am b/src/elementaryFunctions/exp/Makefile.am
index 3b82230a..6b7a38f9 100644
--- a/src/elementaryFunctions/exp/Makefile.am
+++ b/src/elementaryFunctions/exp/Makefile.am
@@ -5,7 +5,7 @@
## Made by Bruno JOFRET <bruno.jofret@inria.fr>
##
## Started on Fri Jan 5 10:19:16 2007 jofret
-## Last update Sun Mar 25 20:58:13 2007 bruno
+## Last update Wed Apr 18 17:09:35 2007 jofret
##
## Copyright INRIA 2007
##
@@ -31,3 +31,21 @@ SRC = sexps.c \
zexpa.c
HEAD = ../includes/exp.h
+
+####
+# Checking Part
+####
+
+check_INCLUDES = -I $(top_builddir)/elementaryFunctions/includes \
+ -I $(top_builddir)/type
+
+check_PROGRAMS = testExp
+
+TESTS = testExp
+
+testExp_SOURCES = testExp.c
+testExp_CFLAGS = $(check_INCLUDES)
+testExp_LDADD = $(top_builddir)/lib/libDoubleComplex.a \
+ $(top_builddir)/lib/libFloatComplex.a \
+ $(top_builddir)/lib/libExp.a \
+ @LIBMATH@ \ No newline at end of file
diff --git a/src/elementaryFunctions/exp/Makefile.in b/src/elementaryFunctions/exp/Makefile.in
index 926b6143..3d8dbc1e 100644
--- a/src/elementaryFunctions/exp/Makefile.in
+++ b/src/elementaryFunctions/exp/Makefile.in
@@ -36,6 +36,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
+check_PROGRAMS = testExp$(EXEEXT)
subdir = elementaryFunctions/exp
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -65,6 +66,11 @@ am__objects_2 = sexps.$(OBJEXT) dexps.$(OBJEXT) cexps.$(OBJEXT) \
cexpa.$(OBJEXT) zexpa.$(OBJEXT)
am_libExp_a_OBJECTS = $(am__objects_1) $(am__objects_2)
libExp_a_OBJECTS = $(am_libExp_a_OBJECTS)
+am_testExp_OBJECTS = testExp-testExp.$(OBJEXT)
+testExp_OBJECTS = $(am_testExp_OBJECTS)
+testExp_DEPENDENCIES = $(top_builddir)/lib/libDoubleComplex.a \
+ $(top_builddir)/lib/libFloatComplex.a \
+ $(top_builddir)/lib/libExp.a
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/includes
depcomp = $(SHELL) $(top_srcdir)/config/depcomp
am__depfiles_maybe = depfiles
@@ -72,8 +78,8 @@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = $(libExp_a_SOURCES)
-DIST_SOURCES = $(libExp_a_SOURCES)
+SOURCES = $(libExp_a_SOURCES) $(testExp_SOURCES)
+DIST_SOURCES = $(libExp_a_SOURCES) $(testExp_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -189,6 +195,21 @@ SRC = sexps.c \
zexpa.c
HEAD = ../includes/exp.h
+
+####
+# Checking Part
+####
+check_INCLUDES = -I $(top_builddir)/elementaryFunctions/includes \
+ -I $(top_builddir)/type
+
+TESTS = testExp
+testExp_SOURCES = testExp.c
+testExp_CFLAGS = $(check_INCLUDES)
+testExp_LDADD = $(top_builddir)/lib/libDoubleComplex.a \
+ $(top_builddir)/lib/libFloatComplex.a \
+ $(top_builddir)/lib/libExp.a \
+ @LIBMATH@
+
all: all-am
.SUFFIXES:
@@ -259,6 +280,12 @@ libExp.a: $(libExp_a_OBJECTS) $(libExp_a_DEPENDENCIES)
$(libExp_a_AR) libExp.a $(libExp_a_OBJECTS) $(libExp_a_LIBADD)
$(RANLIB) libExp.a
+clean-checkPROGRAMS:
+ -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS)
+testExp$(EXEEXT): $(testExp_OBJECTS) $(testExp_DEPENDENCIES)
+ @rm -f testExp$(EXEEXT)
+ $(LINK) $(testExp_LDFLAGS) $(testExp_OBJECTS) $(testExp_LDADD) $(LIBS)
+
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -271,6 +298,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dexps.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sexpa.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sexps.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testExp-testExp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zexpa.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zexps.Po@am__quote@
@@ -287,6 +315,20 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+testExp-testExp.o: testExp.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testExp_CFLAGS) $(CFLAGS) -MT testExp-testExp.o -MD -MP -MF "$(DEPDIR)/testExp-testExp.Tpo" -c -o testExp-testExp.o `test -f 'testExp.c' || echo '$(srcdir)/'`testExp.c; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/testExp-testExp.Tpo" "$(DEPDIR)/testExp-testExp.Po"; else rm -f "$(DEPDIR)/testExp-testExp.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testExp.c' object='testExp-testExp.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testExp_CFLAGS) $(CFLAGS) -c -o testExp-testExp.o `test -f 'testExp.c' || echo '$(srcdir)/'`testExp.c
+
+testExp-testExp.obj: testExp.c
+@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testExp_CFLAGS) $(CFLAGS) -MT testExp-testExp.obj -MD -MP -MF "$(DEPDIR)/testExp-testExp.Tpo" -c -o testExp-testExp.obj `if test -f 'testExp.c'; then $(CYGPATH_W) 'testExp.c'; else $(CYGPATH_W) '$(srcdir)/testExp.c'; fi`; \
+@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/testExp-testExp.Tpo" "$(DEPDIR)/testExp-testExp.Po"; else rm -f "$(DEPDIR)/testExp-testExp.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='testExp.c' object='testExp-testExp.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(testExp_CFLAGS) $(CFLAGS) -c -o testExp-testExp.obj `if test -f 'testExp.c'; then $(CYGPATH_W) 'testExp.c'; else $(CYGPATH_W) '$(srcdir)/testExp.c'; fi`
uninstall-info-am:
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@@ -337,6 +379,79 @@ GTAGS:
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+ srcdir=$(srcdir); export srcdir; \
+ list='$(TESTS)'; \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *" $$tst "*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ echo "XPASS: $$tst"; \
+ ;; \
+ *) \
+ echo "PASS: $$tst"; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *" $$tst "*) \
+ xfail=`expr $$xfail + 1`; \
+ echo "XFAIL: $$tst"; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ echo "SKIP: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="All $$all tests passed"; \
+ else \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all tests failed"; \
+ else \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
@@ -365,6 +480,8 @@ distdir: $(DISTFILES)
fi; \
done
check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
all-am: Makefile $(LIBRARIES)
installdirs:
@@ -397,8 +514,8 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-generic clean-instLIBRARIES clean-noinstLIBRARIES \
- mostlyclean-am
+clean-am: clean-checkPROGRAMS clean-generic clean-instLIBRARIES \
+ clean-noinstLIBRARIES mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
@@ -445,12 +562,13 @@ ps-am:
uninstall-am: uninstall-info-am uninstall-instLIBRARIES
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-instLIBRARIES clean-noinstLIBRARIES ctags distclean \
- distclean-compile distclean-generic distclean-tags distdir dvi \
- dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-exec install-exec-am \
- install-info install-info-am install-instLIBRARIES install-man \
+.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
+ clean-checkPROGRAMS clean-generic clean-instLIBRARIES \
+ clean-noinstLIBRARIES ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-instLIBRARIES install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
diff --git a/src/elementaryFunctions/exp/testExp.c b/src/elementaryFunctions/exp/testExp.c
new file mode 100644
index 00000000..7ad75191
--- /dev/null
+++ b/src/elementaryFunctions/exp/testExp.c
@@ -0,0 +1,66 @@
+/*
+** -*- C -*-
+**
+** testExp.c
+** Made by Bruno JOFRET <bruno.jofret@inria.fr>
+**
+** Started on Fri Dec 8 15:05:44 2006 jofret
+** Last update Wed Apr 18 17:11:29 2007 jofret
+**
+** Copyright INRIA 2006
+*/
+
+#include "testExp.h"
+
+#define PI 3.1415826535
+
+void sexpsTest(void) {
+ printf(">> Float scalar\n");
+ printf("sexps(0) = %f\n", sexps((float) 0));
+ printf("sexps(PI) = %f\n", sexps(PI));
+ printf("sexps(PI/2) = %f\n", sexps(PI/2));
+ printf("sexps(PI/3) = %f\n", sexps(PI/3));
+ printf("sexps(PI/4) = %f\n", sexps(PI/4));
+ printf("sexps(PI/6) = %f\n", sexps(PI/6));
+ printf("sexps(-PI) = %f\n", sexps(-PI));
+ printf("sexps(-PI/2) = %f\n", sexps(-PI/2));
+ printf("sexps(-PI/3) = %f\n", sexps(-PI/3));
+ printf("sexps(-PI/4) = %f\n", sexps(-PI/4));
+ printf("sexps(-PI/6) = %f\n", sexps(-PI/6));
+}
+
+void dexpsTest(void) {
+ printf(">> Double scalar\n");
+ printf("dexps(0) = %e\n", dexps((double) 0));
+ printf("dexps(PI) = %e\n", dexps(PI));
+ printf("dexps(PI/2) = %e\n", dexps(PI/2));
+ printf("dexps(PI/3) = %e\n", dexps(PI/3));
+ printf("dexps(PI/4) = %e\n", dexps(PI/4));
+ printf("dexps(PI/6) = %e\n", dexps(PI/6));
+ printf("dexps(-PI) = %e\n", dexps(-PI));
+ printf("dexps(-PI/2) = %e\n", dexps(-PI/2));
+ printf("dexps(-PI/3) = %e\n", dexps(-PI/3));
+ printf("dexps(-PI/4) = %e\n", dexps(-PI/4));
+ printf("dexps(-PI/6) = %e\n", dexps(-PI/6));
+}
+
+int testExp(void) {
+ printf("\n>>>> Exponential Tests\n");
+ sexpsTest();
+ dexpsTest();
+ /* FIXME : Implement some test here ... */
+ /*
+ cexpsTest();
+ zexpsTest();
+ sexpaTest();
+ dexpaTest();
+ cexpaTest();
+ zexpaTest();
+ */
+ return 0;
+}
+
+int main(void) {
+ assert(testExp() == 0);
+ return 0;
+}
diff --git a/src/elementaryFunctions/exp/testExp.h b/src/elementaryFunctions/exp/testExp.h
new file mode 100644
index 00000000..f6549602
--- /dev/null
+++ b/src/elementaryFunctions/exp/testExp.h
@@ -0,0 +1,40 @@
+/*
+** -*- C -*-
+**
+** testExp.h
+** Made by Bruno JOFRET <bruno.jofret@inria.fr>
+**
+** Started on Wed Apr 18 17:07:03 2007 jofret
+** Last update Wed Apr 18 17:07:43 2007 jofret
+**
+** Copyright INRIA 2007
+*/
+
+#ifndef _TESTEXP_H_
+#define _TESTEXP_H_
+
+#include <stdio.h>
+#include <assert.h>
+#include "exp.h"
+#include "constant.h"
+
+
+void sexpsTest(void);
+
+void dexpsTest(void);
+
+void cexpsTest(void);
+
+void zexpsTest(void);
+
+void sexpaTest(void);
+
+void dexpaTest(void);
+
+void cexpaTest(void);
+
+void zexpaTest(void);
+
+int testExp(void);
+
+#endif /* ! _TESTEXP_H_ */