summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/source/main.c3
-rw-r--r--test/source/test/abs.i10
2 files changed, 13 insertions, 0 deletions
diff --git a/test/source/main.c b/test/source/main.c
index 3e33c35..25246cf 100644
--- a/test/source/main.c
+++ b/test/source/main.c
@@ -3,6 +3,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <zap/mem.h>
+#include <zap/mth.h>
#define zaptest_log(_expr,_typ,_fmtspec) (fprintf(stderr,"(" #_expr "): " _fmtspec "\n\n",(_typ)(_expr)));
@@ -17,6 +18,7 @@
typedef bool (* zaptest_testtyp)(void);
+#include "test/abs.i"
#include "test/bool.i"
#include "test/cmp.i"
#include "test/memcnt.i"
@@ -39,6 +41,7 @@ typedef bool (* zaptest_testtyp)(void);
#include "test/win1252enc.i"
static zaptest_testtyp zaptest_tests[] = {
+ zaptest_test_abs,
zaptest_test_bool,
zaptest_test_cmp,
zaptest_test_memcnt,
diff --git a/test/source/test/abs.i b/test/source/test/abs.i
new file mode 100644
index 0000000..81b6c10
--- /dev/null
+++ b/test/source/test/abs.i
@@ -0,0 +1,10 @@
+#include <stdbool.h>
+
+static bool zaptest_test_abs(void) {
+ zaptest_chk(zap_abs_i(-0x8000),0x8000u,unsigned int,"%X")
+ zaptest_chk(zap_abs_l(-0x80000000),0x80000000u,unsigned long,"%lX")
+ zaptest_chk(zap_abs_ll(-0x8000000000000000),0x8000000000000000u,unsigned long long,"%llX")
+ zaptest_chk(zap_abs_s(-0x8000),0x8000u,unsigned int,"%X")
+ zaptest_chk(zap_abs_sc(-0x80),0x80,unsigned char,"%hhX")
+ return false;
+}