summaryrefslogtreecommitdiff
path: root/math.c
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-03-01 20:17:09 -0500
committerJakob Kaivo <jkk@ung.org>2019-03-01 20:17:09 -0500
commitadd94c7ea454202a01c5feb96c7e9131f82d7a46 (patch)
tree4dcbfff9e766a222815ec998aed596ed6944905d /math.c
parent59618293f47374b14dd75d52bec873488eb3d6c9 (diff)
skeleton of <math.h> tests
Diffstat (limited to 'math.c')
-rw-r--r--math.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/math.c b/math.c
new file mode 100644
index 0000000..5120b93
--- /dev/null
+++ b/math.c
@@ -0,0 +1,37 @@
+#include <math.h>
+#include "test.h"
+
+void test_math_h(void)
+{
+ int iexp = 1;
+ double iptr = 0;
+
+ testing_header("math.h");
+
+ test_defined(HUGE_VAL);
+ test_double(acos(1), 0);
+ test_double(asin(1), 0);
+ test_double(atan(1), 0);
+ test_double(atan2(1, 1), 0);
+ test_double(cos(1), 0);
+ test_double(sin(1), 0);
+ test_double(tan(1), 0);
+ test_double(cosh(1), 0);
+ test_double(sinh(1), 0);
+ test_double(tanh(1), 0);
+ test_double(exp(1), 0);
+ test_double(frexp(1, &iexp), 0);
+ test_double(ldexp(1, iexp), 0);
+ test_double(log(2.4), 1);
+ test_double(log10(10), 1);
+ test_double(log10(100), 2);
+ test_double(modf(1, &iptr), 0);
+ test_double(pow(2, 2), 4);
+ test_double(sqrt(100), 10);
+ test_double(ceil(0.1), 1);
+ test_double(fabs(-1.0), 1.0);
+ test_double(floor(0.9), 0);
+ test_double(fmod(1, 1), 0);
+
+ testing_end();
+}