-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_math.c
More file actions
42 lines (35 loc) · 592 Bytes
/
Copy pathtest_math.c
File metadata and controls
42 lines (35 loc) · 592 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright 2022 Mark Seminatore. All rights reserved.
#include "math.h"
#include "testy/test.h"
//
static void test_fabs()
{
SUITE("fabs");
TEST(1.0 == fabs(1.0));
TEST(1.0 == fabs(-1.0));
TEST(0.0 == fabs(0.0));
TEST(3.14 == fabs(-3.14));
}
//
static void test_fabsf()
{
SUITE("fabsf");
TEST(1.0f == fabsf(1.0f));
TEST(1.0f == fabsf(-1.0f));
TEST(0.0f == fabsf(0.0f));
}
//
static void test_fabsl()
{
SUITE("fabsl");
TEST(1.0L == fabsl(1.0L));
TEST(1.0L == fabsl(-1.0L));
TEST(0.0L == fabsl(0.0L));
}
//
void test_math()
{
test_fabs();
test_fabsf();
test_fabsl();
}