summaryrefslogtreecommitdiff
path: root/src/auxiliaryFunctions/pythag/testPythag.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/auxiliaryFunctions/pythag/testPythag.c')
-rw-r--r--src/auxiliaryFunctions/pythag/testPythag.c50
1 files changed, 50 insertions, 0 deletions
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;
+}