scsl 1.0.1
Shimmering Clarity Standard Library
Loading...
Searching...
No Matches
Checks.h
Go to the documentation of this file.
1
22
23#ifndef SCTEST_CHECKS_H
24#define SCTEST_CHECKS_H
25
26#include <scmp/Math.h>
27
28
29namespace sctest {
30
31
32// The following checks are designed as shortcuts that return false on
33// if some condition isn't met.
34#define SCTEST_CHECK(x) if (!(x)) { return false; }
35#define SCTEST_CHECK_FALSE(x) if ((x)) { return false; }
36#define SCTEST_CHECK_EQ(x, y) if ((x) != (y)) { return false; }
37#define SCTEST_CHECK_NE(x, y) if ((x) == (y)) { return false; }
38#define SCTEST_CHECK_GEQ(x, y) if ((x) < (y)) { return false; }
39#define SCTEST_CHECK_LEQ(x, y) if ((x) > (y)) { return false; }
40#define SCTEST_CHECK_FEQ(x, y) { float eps; scmp::DefaultEpsilon(eps); if (!scmp::WithinTolerance((x), (y), eps)) { return false; }}
41#define SCTEST_CHECK_DEQ(x, y) { double eps; scmp::DefaultEpsilon(eps); if (!scmp::WithinTolerance((x), (y), eps)) { return false; }}
42
43#define SCTEST_CHECK_FEQ_EPS(x, y, eps) { if (!scmp::WithinTolerance<float>((x), (y), (eps))) { return false; }}
44#define SCTEST_CHECK_FNE_EPS(x, y, eps) { if (scmp::WithinTolerance<float>((x), (y), (eps))) { return false; }}
45
46#define SCTEST_CHECK_DEQ_EPS(x, y, eps) { if (!scmp::WithinTolerance<double>((x), (y), (eps))) { return false; }}
47#define SCTEST_CHECK_DNE_EPS(x, y, eps) { if (scmp::WithinTolerance<double>((x), (y), (eps))) { return false; }}
48
49
50
51} // namespace sctest
52
53
54#endif
Common math functions.
Shimmering Clarity testing library.
Definition sctest.h:34