diff options
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/Makefile | 11 | ||||
-rw-r--r-- | src/test/test.c | 18 | ||||
-rw-r--r-- | src/test/test.h | 22 | ||||
-rw-r--r-- | src/test/testCosh.c | 56 | ||||
-rw-r--r-- | src/test/testSinh.c | 55 | ||||
-rw-r--r-- | src/test/testTan.c | 56 | ||||
-rw-r--r-- | src/test/testTanh.c | 56 |
7 files changed, 268 insertions, 6 deletions
diff --git a/src/test/Makefile b/src/test/Makefile index 5d7378ff..951a1272 100644 --- a/src/test/Makefile +++ b/src/test/Makefile @@ -5,7 +5,7 @@ ## Made by Bruno JOFRET <bruno.jofret@inria.fr> ## ## Started on Thu Nov 30 16:33:40 2006 jofret -## Last update Fri Dec 8 16:55:15 2006 jofret +## Last update Mon Jan 29 17:17:19 2007 jofret ## ## Copyright INRIA 2006 ## @@ -16,14 +16,21 @@ RM = rm -f CC = gcc INCLUDE = ../type LINK = ../lib -LIBS = -lm -lSin -lCos +LIBS = -lm \ + -lCos -lCosh \ + -lSin -lSinh \ + -lTan -lTanh CFLAGS = -Werror -Wall -pedantic -ansi CLFLAGS = -I$(INCLUDE) -L$(LINK) $(LIBS) AR = ar cru RANLIB = ranlib SRC = testCos.c \ + testCosh.c \ testSin.c \ + testSinh.c \ + testTan.c \ + testTanh.c \ test.c HEAD = test.h diff --git a/src/test/test.c b/src/test/test.c index d1867f8b..ffeeeb2a 100644 --- a/src/test/test.c +++ b/src/test/test.c @@ -5,7 +5,7 @@ ** Made by Bruno JOFRET <bruno.jofret@inria.fr> ** ** Started on Fri Dec 8 14:53:51 2006 jofret -** Last update Fri Dec 8 15:04:07 2006 jofret +** Last update Mon Jan 29 17:24:07 2007 jofret ** ** Copyright INRIA 2006 */ @@ -18,7 +18,9 @@ void newline() { } int main(int argc, char** argv) { - int cosStatus, sinStatus; + int cosStatus, coshStatus = 0; + int sinStatus, sinhStatus = 0; + int tanStatus, tanhStatus = 0; printf("-*- -> Begin test sequence <- -*-"); @@ -26,11 +28,21 @@ int main(int argc, char** argv) { /* Test Cosine stuffs */ cosStatus = testCos(); + /* Test Hyperbolic Cosine stuffs */ + coshStatus = testCosh(); /* Test Sine stuffs */ sinStatus = testSin(); + /* Test Hyperbolic Sine stuffs */ + sinStatus = testSinh(); + /* Test Tangeant stuffs */ + tanStatus = testTan(); + /* Test Hyperbolic Tangeant stuffs */ + tanhStatus = testTanh(); printf("-*- -> End test sequence <- -*-"); newline(); - return (cosStatus+sinStatus); + return (cosStatus+coshStatus+ + sinStatus+sinhStatus+ + tanStatus+tanhStatus); } diff --git a/src/test/test.h b/src/test/test.h index 0b4b7a46..3b0d3e09 100644 --- a/src/test/test.h +++ b/src/test/test.h @@ -5,7 +5,7 @@ ** Made by Bruno JOFRET <bruno.jofret@inria.fr> ** ** Started on Fri Dec 8 15:00:40 2006 jofret -** Last update Fri Dec 8 15:04:17 2006 jofret +** Last update Mon Jan 29 17:16:36 2007 jofret ** ** Copyright INRIA 2006 */ @@ -16,7 +16,27 @@ int testCos(); /* +** \brief Hyperbolic Cosine Test +*/ +int testCosh(); + +/* ** \brief Sine Test */ int testSin(); +/* +** \brief Hyperbolic Sine Test +*/ +int testSinh(); + +/* +** \brief Tangeant Test +*/ +int testTan(); + +/* +** \brief Hyperbolic Tangeant Test +*/ +int testTanh(); + diff --git a/src/test/testCosh.c b/src/test/testCosh.c new file mode 100644 index 00000000..0efb9868 --- /dev/null +++ b/src/test/testCosh.c @@ -0,0 +1,56 @@ +/* +** -*- C -*- +** +** testCosh.c +** Made by Bruno JOFRET <bruno.jofret@inria.fr> +** +** Started on Fri Dec 8 15:05:44 2006 jofret +** Last update Mon Jan 29 16:15:15 2007 jofret +** +** Copyright INRIA 2006 +*/ + +#include <stdio.h> + +#define PI 3.1415826535 + +float scoshs(float); +double dcoshs(double); + + +void scoshsTest() { + printf(">> Float scalar\n"); + printf("scoshs(0) = %f\n", scoshs((float) 0)); + printf("scoshs(PI) = %f\n", scoshs(PI)); + printf("scoshs(PI/2) = %f\n", scoshs(PI/2)); + printf("scoshs(PI/3) = %f\n", scoshs(PI/3)); + printf("scoshs(PI/4) = %f\n", scoshs(PI/4)); + printf("scoshs(PI/6) = %f\n", scoshs(PI/6)); + printf("scoshs(-PI) = %f\n", scoshs(-PI)); + printf("scoshs(-PI/2) = %f\n", scoshs(-PI/2)); + printf("scoshs(-PI/3) = %f\n", scoshs(-PI/3)); + printf("scoshs(-PI/4) = %f\n", scoshs(-PI/4)); + printf("scoshs(-PI/6) = %f\n", scoshs(-PI/6)); +} + +void dcoshsTest() { + printf(">> Double scalar\n"); + printf("dcoshs(0) = %e\n", dcoshs((double) 0)); + printf("dcoshs(PI) = %e\n", dcoshs(PI)); + printf("dcoshs(PI/2) = %e\n", dcoshs(PI/2)); + printf("dcoshs(PI/3) = %e\n", dcoshs(PI/3)); + printf("dcoshs(PI/4) = %e\n", dcoshs(PI/4)); + printf("dcoshs(PI/6) = %e\n", dcoshs(PI/6)); + printf("dcoshs(-PI) = %e\n", dcoshs(-PI)); + printf("dcoshs(-PI/2) = %e\n", dcoshs(-PI/2)); + printf("dcoshs(-PI/3) = %e\n", dcoshs(-PI/3)); + printf("dcoshs(-PI/4) = %e\n", dcoshs(-PI/4)); + printf("dcoshs(-PI/6) = %e\n", dcoshs(-PI/6)); +} + +int testCosh() { + printf(">>>> Hyperbolic Cosine Tests\n"); + scoshsTest(); + dcoshsTest(); + return 0; +} diff --git a/src/test/testSinh.c b/src/test/testSinh.c new file mode 100644 index 00000000..22ac851c --- /dev/null +++ b/src/test/testSinh.c @@ -0,0 +1,55 @@ +/* +** -*- C -*- +** +** testSinh.c +** Made by Bruno JOFRET <bruno.jofret@inria.fr> +** +** Started on Fri Dec 8 15:06:16 2006 jofret +** Last update Mon Jan 29 16:16:59 2007 jofret +** +** Copyright INRIA 2006 +*/ + +#include <stdio.h> + +#define PI 3.1415826535 + +float ssinhs(float); +double dsinhs(double); + +void ssinhsTest() { + printf(">> Float scalar\n"); + printf("ssinhs(0) = %f\n", ssinhs((float) 0)); + printf("ssinhs(PI) = %f\n", ssinhs(PI)); + printf("ssinhs(PI/2) = %f\n", ssinhs(PI/2)); + printf("ssinhs(PI/3) = %f\n", ssinhs(PI/3)); + printf("ssinhs(PI/4) = %f\n", ssinhs(PI/4)); + printf("ssinhs(PI/6) = %f\n", ssinhs(PI/6)); + printf("ssinhs(-PI) = %f\n", ssinhs(-PI)); + printf("ssinhs(-PI/2) = %f\n", ssinhs(-PI/2)); + printf("ssinhs(-PI/3) = %f\n", ssinhs(-PI/3)); + printf("ssinhs(-PI/4) = %f\n", ssinhs(-PI/4)); + printf("ssinhs(-PI/6) = %f\n", ssinhs(-PI/6)); +} + +void dsinhsTest() { + printf(">> Double scalar\n"); + printf("dsinhs(0) = %e\n", dsinhs((double) 0)); + printf("dsinhs(PI) = %e\n", dsinhs(PI)); + printf("dsinhs(PI/2) = %e\n", dsinhs(PI/2)); + printf("dsinhs(PI/3) = %e\n", dsinhs(PI/3)); + printf("dsinhs(PI/4) = %e\n", dsinhs(PI/4)); + printf("dsinhs(PI/6) = %e\n", dsinhs(PI/6)); + printf("dsinhs(-PI) = %e\n", dsinhs(-PI)); + printf("dsinhs(-PI/2) = %e\n", dsinhs(-PI/2)); + printf("dsinhs(-PI/3) = %e\n", dsinhs(-PI/3)); + printf("dsinhs(-PI/4) = %e\n", dsinhs(-PI/4)); + printf("dsinhs(-PI/6) = %e\n", dsinhs(-PI/6)); +} + +int testSinh() { + printf(">>>> Hyperbolic Sine Tests\n"); + ssinhsTest(); + dsinhsTest(); + return 0; +} diff --git a/src/test/testTan.c b/src/test/testTan.c new file mode 100644 index 00000000..0b1f1c52 --- /dev/null +++ b/src/test/testTan.c @@ -0,0 +1,56 @@ +/* +** -*- C -*- +** +** testTan.c +** Made by Bruno JOFRET <bruno.jofret@inria.fr> +** +** Started on Fri Dec 8 15:05:44 2006 jofret +** Last update Mon Jan 29 17:13:12 2007 jofret +** +** Copyright INRIA 2006 +*/ + +#include <stdio.h> + +#define PI 3.1415826535 + +float stans(float); +double dtans(double); + + +void stansTest() { + printf(">> Float scalar\n"); + printf("stans(0) = %f\n", stans((float) 0)); + printf("stans(PI) = %f\n", stans(PI)); + printf("stans(PI/2) = %f\n", stans(PI/2)); + printf("stans(PI/3) = %f\n", stans(PI/3)); + printf("stans(PI/4) = %f\n", stans(PI/4)); + printf("stans(PI/6) = %f\n", stans(PI/6)); + printf("stans(-PI) = %f\n", stans(-PI)); + printf("stans(-PI/2) = %f\n", stans(-PI/2)); + printf("stans(-PI/3) = %f\n", stans(-PI/3)); + printf("stans(-PI/4) = %f\n", stans(-PI/4)); + printf("stans(-PI/6) = %f\n", stans(-PI/6)); +} + +void dtansTest() { + printf(">> Double scalar\n"); + printf("dtans(0) = %e\n", dtans((double) 0)); + printf("dtans(PI) = %e\n", dtans(PI)); + printf("dtans(PI/2) = %e\n", dtans(PI/2)); + printf("dtans(PI/3) = %e\n", dtans(PI/3)); + printf("dtans(PI/4) = %e\n", dtans(PI/4)); + printf("dtans(PI/6) = %e\n", dtans(PI/6)); + printf("dtans(-PI) = %e\n", dtans(-PI)); + printf("dtans(-PI/2) = %e\n", dtans(-PI/2)); + printf("dtans(-PI/3) = %e\n", dtans(-PI/3)); + printf("dtans(-PI/4) = %e\n", dtans(-PI/4)); + printf("dtans(-PI/6) = %e\n", dtans(-PI/6)); +} + +int testTan() { + printf(">>>> Tangeant Tests\n"); + stansTest(); + dtansTest(); + return 0; +} diff --git a/src/test/testTanh.c b/src/test/testTanh.c new file mode 100644 index 00000000..77c4452e --- /dev/null +++ b/src/test/testTanh.c @@ -0,0 +1,56 @@ +/* +** -*- C -*- +** +** testTanh.c +** Made by Bruno JOFRET <bruno.jofret@inria.fr> +** +** Started on Fri Dec 8 15:05:44 2006 jofret +** Last update Mon Jan 29 17:14:52 2007 jofret +** +** Copyright INRIA 2006 +*/ + +#include <stdio.h> + +#define PI 3.1415826535 + +float stanhs(float); +double dtanhs(double); + + +void stanhsTest() { + printf(">> Float scalar\n"); + printf("stanhs(0) = %f\n", stanhs((float) 0)); + printf("stanhs(PI) = %f\n", stanhs(PI)); + printf("stanhs(PI/2) = %f\n", stanhs(PI/2)); + printf("stanhs(PI/3) = %f\n", stanhs(PI/3)); + printf("stanhs(PI/4) = %f\n", stanhs(PI/4)); + printf("stanhs(PI/6) = %f\n", stanhs(PI/6)); + printf("stanhs(-PI) = %f\n", stanhs(-PI)); + printf("stanhs(-PI/2) = %f\n", stanhs(-PI/2)); + printf("stanhs(-PI/3) = %f\n", stanhs(-PI/3)); + printf("stanhs(-PI/4) = %f\n", stanhs(-PI/4)); + printf("stanhs(-PI/6) = %f\n", stanhs(-PI/6)); +} + +void dtanhsTest() { + printf(">> Double scalar\n"); + printf("dtanhs(0) = %e\n", dtanhs((double) 0)); + printf("dtanhs(PI) = %e\n", dtanhs(PI)); + printf("dtanhs(PI/2) = %e\n", dtanhs(PI/2)); + printf("dtanhs(PI/3) = %e\n", dtanhs(PI/3)); + printf("dtanhs(PI/4) = %e\n", dtanhs(PI/4)); + printf("dtanhs(PI/6) = %e\n", dtanhs(PI/6)); + printf("dtanhs(-PI) = %e\n", dtanhs(-PI)); + printf("dtanhs(-PI/2) = %e\n", dtanhs(-PI/2)); + printf("dtanhs(-PI/3) = %e\n", dtanhs(-PI/3)); + printf("dtanhs(-PI/4) = %e\n", dtanhs(-PI/4)); + printf("dtanhs(-PI/6) = %e\n", dtanhs(-PI/6)); +} + +int testTanh() { + printf(">>>> Hyperbolic Tangeant Tests\n"); + stanhsTest(); + dtanhsTest(); + return 0; +} |