diff options
-rw-r--r-- | src/auxiliaryFunctions/pythag/Makefile.am | 6 | ||||
-rw-r--r-- | src/auxiliaryFunctions/pythag/Makefile.in | 7 | ||||
-rw-r--r-- | src/auxiliaryFunctions/pythag/testPythag.c | 50 | ||||
-rw-r--r-- | src/auxiliaryFunctions/pythag/testPythag.h | 26 |
4 files changed, 85 insertions, 4 deletions
diff --git a/src/auxiliaryFunctions/pythag/Makefile.am b/src/auxiliaryFunctions/pythag/Makefile.am index 2597abe4..ada5de84 100644 --- a/src/auxiliaryFunctions/pythag/Makefile.am +++ b/src/auxiliaryFunctions/pythag/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 Mon Apr 23 15:43:36 2007 jofret +## Last update Tue Apr 24 11:59:13 2007 jofret ## ## Copyright INRIA 2007 ## @@ -31,7 +31,8 @@ HEAD = ../includes/pythag.h # Checking Part #### -check_INCLUDES = -I $(top_builddir)/elementaryFunctions/includes \ +check_INCLUDES = -I $(top_builddir)/auxiliaryFunctions/includes \ + -I $(top_builddir)/elementaryFunctions/includes \ -I $(top_builddir)/type check_PROGRAMS = testPythag @@ -44,4 +45,5 @@ TESTS = testPythag testPythag_SOURCES = testPythag.c testPythag_CFLAGS = $(check_INCLUDES) testPythag_LDADD = $(top_builddir)/lib/libPythag.a \ + $(top_builddir)/lib/libSqrt.a \ @LIBMATH@ diff --git a/src/auxiliaryFunctions/pythag/Makefile.in b/src/auxiliaryFunctions/pythag/Makefile.in index c2fb7724..6ab14838 100644 --- a/src/auxiliaryFunctions/pythag/Makefile.in +++ b/src/auxiliaryFunctions/pythag/Makefile.in @@ -66,7 +66,8 @@ am_libPythag_a_OBJECTS = $(am__objects_1) $(am__objects_2) libPythag_a_OBJECTS = $(am_libPythag_a_OBJECTS) am_testPythag_OBJECTS = testPythag-testPythag.$(OBJEXT) testPythag_OBJECTS = $(am_testPythag_OBJECTS) -testPythag_DEPENDENCIES = $(top_builddir)/lib/libPythag.a +testPythag_DEPENDENCIES = $(top_builddir)/lib/libPythag.a \ + $(top_builddir)/lib/libSqrt.a DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/includes depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles @@ -190,7 +191,8 @@ HEAD = ../includes/pythag.h #### # Checking Part #### -check_INCLUDES = -I $(top_builddir)/elementaryFunctions/includes \ +check_INCLUDES = -I $(top_builddir)/auxiliaryFunctions/includes \ + -I $(top_builddir)/elementaryFunctions/includes \ -I $(top_builddir)/type TESTS = testPythag @@ -201,6 +203,7 @@ TESTS = testPythag testPythag_SOURCES = testPythag.c testPythag_CFLAGS = $(check_INCLUDES) testPythag_LDADD = $(top_builddir)/lib/libPythag.a \ + $(top_builddir)/lib/libSqrt.a \ @LIBMATH@ all: all-am diff --git a/src/auxiliaryFunctions/pythag/testPythag.c b/src/auxiliaryFunctions/pythag/testPythag.c new file mode 100644 index 00000000..2291823f --- /dev/null +++ b/src/auxiliaryFunctions/pythag/testPythag.c @@ -0,0 +1,50 @@ +/* +** -*- C -*- +** +** testPythag.c +** Made by Bruno JOFRET <bruno.jofret@inria.fr> +** +** Started on Wed Feb 14 15:50:15 2007 jofret +** Last update Tue Apr 24 11:35:22 2007 jofret +** +** Copyright INRIA 2007 +*/ + +#include "testPythag.h" + +int spythagsTest() { + printf(">> Floats \n"); + float value1 = -3; + float value2 = 4; + assert(spythags(value1, value2) == 5); + assert(spythags(0, 0) == 0); + assert(spythags(-3, 0) == 3); + assert(spythags(3, 0) == 3); + return 0; +} + +int dpythagsTest() { + printf(">> Doubles \n"); + double value1 = -3; + double value2 = 4; + assert(dpythags(value1, value2) == 5); + assert(dpythags(0, 0) == 0); + assert(dpythags(-3, 0) == 3); + assert(dpythags(3, 0) == 3); + return 0; +} + +int testPythag() { + int spythagsStatus, dpythagsStatus = 0; + + printf(">>>> Pythag Tests\n"); + spythagsStatus = spythagsTest(); + dpythagsStatus = dpythagsTest(); + + return (spythagsStatus + dpythagsStatus); +} + +int main(void) { + assert(testPythag() == 0); + return 0; +} diff --git a/src/auxiliaryFunctions/pythag/testPythag.h b/src/auxiliaryFunctions/pythag/testPythag.h new file mode 100644 index 00000000..1d32dc37 --- /dev/null +++ b/src/auxiliaryFunctions/pythag/testPythag.h @@ -0,0 +1,26 @@ + /* +** -*- C -*- +** +** testPythag.h +** Made by Bruno JOFRET <bruno.jofret@inria.fr> +** +** Started on Mon Apr 23 16:26:14 2007 jofret +** Last update Thu Apr 26 10:34:36 2007 jofret +** +** Copyright INRIA 2007 +*/ +#ifndef _TESTPYTHAG_H_ +#define _TESTPYTHAG_H_ + +#include <stdio.h> +#include <assert.h> + +#include "pythag.h" + +int spythagsTest(void); + +int dpythagsTest(void); + +int testPythag(void); + +#endif /* ! _TESTPYTHAG_H_ */ |