summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-08-19 09:28:48 +0200
committerTyge Løvset <[email protected]>2022-08-19 09:28:48 +0200
commit2876492564300f7d55ad1879a37c61f4c57bd122 (patch)
treebcb37909563d646410f546d499eb3ebe49efe5f8
parentbb85e62626580caa7e4e097b464f96fa78bb440e (diff)
downloadSTC-modified-2876492564300f7d55ad1879a37c61f4c57bd122.tar.gz
STC-modified-2876492564300f7d55ad1879a37c61f4c57bd122.zip
Minor update.
-rw-r--r--include/stc/stctest.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/include/stc/stctest.h b/include/stc/stctest.h
index 62504bef..0b5ae4e2 100644
--- a/include/stc/stctest.h
+++ b/include/stc/stctest.h
@@ -132,9 +132,9 @@ static int _stctest_strcmp(int res, const char* OP, ...) {
const char* b = va_arg(ap, const char *);
va_end(ap);
int c = strcmp(a, b);
- if (OP[0] == '<') return OP[1] == '=' ? c <= 0 : c < 0;
- else if (OP[0] == '>') return OP[1] == '=' ? c >= 0 : c > 0;
- return (OP[0] == '!') ^ (c == 0);
+ if (OP[0] == '<') return OP[1] == '=' ? c <= 0 : c < 0;
+ if (OP[0] == '>') return OP[1] == '=' ? c >= 0 : c > 0;
+ return (OP[0] == '!') ^ (c == 0);
}
// Knuth:
@@ -152,10 +152,10 @@ static int _stctest_dblcmp(int res, const char* OP, ...) {
double e = va_arg(ap, double);
double c = a - b;
va_end(ap);
- if (OP[0] == '<') return OP[1] == '=' ? c <= 0 : c < 0;
- else if (OP[0] == '>') return OP[1] == '=' ? c >= 0 : c > 0;
- return (OP[0] == '!') ^ (e == 0 ? approximately_equal(a, b, STCTEST_EPSILON)
- : (c < 0 ? -c : c) < e);
+ if (OP[0] == '<') return OP[1] == '=' ? c <= 0 : c < 0;
+ if (OP[0] == '>') return OP[1] == '=' ? c >= 0 : c > 0;
+ return (OP[0] == '!') ^ (e > 0 ? (c < 0 ? -c : c) < e
+ : approximately_equal(a, b, STCTEST_EPSILON));
}
static int _stctest_valcmp(int res, const char* OP, ...)