summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-08-18 22:39:16 +0200
committerTyge Løvset <[email protected]>2022-08-18 22:39:16 +0200
commit34a08d514c1031e9a4c9af245fb95ccc21b1011a (patch)
treef1607fc3c15ac658f066b0ca7210d9bcdf257ea8 /include
parent70395a84f5d69c96ed669e1ceba69fd2eaa826df (diff)
downloadSTC-modified-34a08d514c1031e9a4c9af245fb95ccc21b1011a.tar.gz
STC-modified-34a08d514c1031e9a4c9af245fb95ccc21b1011a.zip
Removed math.h dep.
Diffstat (limited to 'include')
-rw-r--r--include/stc/stctest.h13
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