diff options
| author | Tyge Løvset <[email protected]> | 2022-08-18 22:39:16 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-08-18 22:39:16 +0200 |
| commit | 34a08d514c1031e9a4c9af245fb95ccc21b1011a (patch) | |
| tree | f1607fc3c15ac658f066b0ca7210d9bcdf257ea8 /include | |
| parent | 70395a84f5d69c96ed669e1ceba69fd2eaa826df (diff) | |
| download | STC-modified-34a08d514c1031e9a4c9af245fb95ccc21b1011a.tar.gz STC-modified-34a08d514c1031e9a4c9af245fb95ccc21b1011a.zip | |
Removed math.h dep.
Diffstat (limited to 'include')
| -rw-r--r-- | include/stc/stctest.h | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/include/stc/stctest.h b/include/stc/stctest.h index 27e31ac4..c1d27de1 100644 --- a/include/stc/stctest.h +++ b/include/stc/stctest.h @@ -62,7 +62,6 @@ #include <time.h>
#include <string.h>
#include <stdarg.h>
-#include <math.h>
#include <inttypes.h>
#define STCTEST_FLOAT_LIMIT 0.00000001
@@ -122,7 +121,7 @@ char*: "`%s`", const char*: "`%s`", \
default: "{%p}")
-static inline int _stctest_strcmp(int res, const char* OP, ...) {
+static int _stctest_strcmp(int res, const char* OP, ...) {
va_list ap;
va_start(ap, OP);
const char* a = va_arg(ap, const char *);
@@ -138,23 +137,23 @@ static inline int _stctest_strcmp(int res, const char* OP, ...) { return c;
}
-static inline int _stctest_dblcmp(int res, const char* OP, ...) {
+static int _stctest_dblcmp(int res, const char* OP, ...) {
va_list ap;
va_start(ap, OP);
double a = va_arg(ap, double);
double b = va_arg(ap, double);
- double c = a - b;
+ double c = a - b, abs = c < 0 ? -c : c;
va_end(ap);
switch (OP[0]) {
- case '=': return fabs(c) < STCTEST_FLOAT_LIMIT;
- case '!': return fabs(c) > STCTEST_FLOAT_LIMIT;
+ case '=': return abs < STCTEST_FLOAT_LIMIT;
+ case '!': return abs > STCTEST_FLOAT_LIMIT;
case '<': return OP[1] == '=' ? c <= 0 : c < 0;
case '>': return OP[1] == '=' ? c >= 0 : c > 0;
}
return res;
}
-static inline int _stctest_valcmp(int res, const char* OP, ...)
+static int _stctest_valcmp(int res, const char* OP, ...)
{ return res; }
#define _stctest_COLOR_CODE 0x1B
|
