summaryrefslogtreecommitdiff
path: root/test/source
diff options
context:
space:
mode:
Diffstat (limited to 'test/source')
-rw-r--r--test/source/main.c108
-rw-r--r--test/source/test/abs.i10
-rw-r--r--test/source/test/bool.i9
-rw-r--r--test/source/test/cmp.i11
-rw-r--r--test/source/test/memcnt.i28
-rw-r--r--test/source/test/memcp.i18
-rw-r--r--test/source/test/memeq.i24
-rw-r--r--test/source/test/memfill.i23
-rw-r--r--test/source/test/memfnd.i33
-rw-r--r--test/source/test/memfor.i23
-rw-r--r--test/source/test/memgen.i29
-rw-r--r--test/source/test/nullptr.i7
-rw-r--r--test/source/test/strcp.i42
-rw-r--r--test/source/test/streq.i21
-rw-r--r--test/source/test/strfill.i18
-rw-r--r--test/source/test/strfnd.i12
-rw-r--r--test/source/test/strlen.i13
-rw-r--r--test/source/test/utf20len.i11
-rw-r--r--test/source/test/utf8dec.i43
-rw-r--r--test/source/test/utf8enc.i42
-rw-r--r--test/source/test/win1252dec.i77
-rw-r--r--test/source/test/win1252enc.i77
22 files changed, 0 insertions, 679 deletions
diff --git a/test/source/main.c b/test/source/main.c
deleted file mode 100644
index 25246cf..0000000
--- a/test/source/main.c
+++ /dev/null
@@ -1,108 +0,0 @@
-#include <inttypes.h>
-#include <stdbool.h>
-#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)));
-
-#define zaptest_chk(_lexpr,_rexpr,_typ,_fmtspec) { \
- fprintf(stderr,"(" #_lexpr "): " _fmtspec "\n",(_typ)(_lexpr)); \
- fprintf(stderr,"(" #_rexpr "): " _fmtspec "\n\n",(_typ)(_rexpr)); \
- if ((_typ)(_lexpr) != (_typ)(_rexpr)) { \
- fprintf(stderr,"Mismatch!\n"); \
- return true; \
- } \
-}
-
-typedef bool (* zaptest_testtyp)(void);
-
-#include "test/abs.i"
-#include "test/bool.i"
-#include "test/cmp.i"
-#include "test/memcnt.i"
-#include "test/memcp.i"
-#include "test/memeq.i"
-#include "test/memfill.i"
-#include "test/memfnd.i"
-#include "test/memfor.i"
-#include "test/memgen.i"
-#include "test/nullptr.i"
-#include "test/strcp.i"
-#include "test/streq.i"
-#include "test/strfill.i"
-#include "test/strfnd.i"
-#include "test/strlen.i"
-#include "test/utf20len.i"
-#include "test/utf8dec.i"
-#include "test/utf8enc.i"
-#include "test/win1252dec.i"
-#include "test/win1252enc.i"
-
-static zaptest_testtyp zaptest_tests[] = {
- zaptest_test_abs,
- zaptest_test_bool,
- zaptest_test_cmp,
- zaptest_test_memcnt,
- zaptest_test_memcp,
- zaptest_test_memeq,
- zaptest_test_memfill,
- zaptest_test_memfnd,
- zaptest_test_memfor,
- zaptest_test_memgen,
- zaptest_test_nullptr,
- zaptest_test_strcp,
- zaptest_test_streq,
- zaptest_test_strfill,
- zaptest_test_strfnd,
- zaptest_test_strlen,
- zaptest_test_utf20len,
- zaptest_test_utf8dec,
- zaptest_test_utf8enc,
- zaptest_test_win1252dec,
- zaptest_test_win1252enc,
-};
-
-static char const * zaptest_testnms[] = {
- "abs",
- "add",
- "bool",
- "cmp",
- "memcnt",
- "memcp",
- "memeq",
- "memfill",
- "memfnd",
- "memfor",
- "memgen",
- "nullptr",
- "strcp",
- "streq",
- "strfill",
- "strfnd",
- "strlen",
- "utf20len",
- "utf8dec",
- "utf8enc",
- "win1252dec",
- "win1252enc",
-};
-
-static void zaptest_dotest(zap_sz const _n) {
- fprintf(stderr,":: \x1B[94mTesting\x1B[0m %s...\n\n",zaptest_testnms[_n]);
- if (zaptest_tests[_n]()) {
- fprintf(stderr,":: \x1B[91mError\x1B[0m in %s! Aborting...\n\n",zaptest_testnms[_n]);
- exit(EXIT_FAILURE);
- }
- fprintf(stderr,":: \x1B[92mSuccess\x1B[0m with %s!\n\n",zaptest_testnms[_n]);
-}
-
-int main(void) {
- fprintf(stderr,"Zap Test\n\n");
- fprintf(stderr,"Version: %lX\n",zap_ver);
- fprintf(stderr,"\n");
- zaptest_log(zap_nopos,zap_sz,"%zX")
- zaptest_log((void *)zap_nullptr,uintptr_t,"%" PRIXPTR)
- for (zap_sz n = 0x0u;n < sizeof (zaptest_tests) / sizeof (zaptest_tests[0x0u]);++n) {zaptest_dotest(n);}
-}
diff --git a/test/source/test/abs.i b/test/source/test/abs.i
deleted file mode 100644
index 81b6c10..0000000
--- a/test/source/test/abs.i
+++ /dev/null
@@ -1,10 +0,0 @@
-#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;
-}
diff --git a/test/source/test/bool.i b/test/source/test/bool.i
deleted file mode 100644
index adacf85..0000000
--- a/test/source/test/bool.i
+++ /dev/null
@@ -1,9 +0,0 @@
-#include <inttypes.h>
-#include <stdbool.h>
-
-static bool zaptest_test_bool(void) {
- zaptest_log(zap_true,uintmax_t,"%" PRIXMAX)
- zaptest_chk(zap_false,0x0u,unsigned char,"%hhX")
- zaptest_chk(zap_true > zap_false,0x1u,unsigned char,"%hhX")
- return false;
-}
diff --git a/test/source/test/cmp.i b/test/source/test/cmp.i
deleted file mode 100644
index fbb7d5c..0000000
--- a/test/source/test/cmp.i
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <inttypes.h>
-#include <stdbool.h>
-
-static bool zaptest_test_cmp(void) {
- zaptest_log(zap_lt,intmax_t,"%" PRIiMAX)
- zaptest_log(zap_gt,intmax_t,"%" PRIiMAX)
- zaptest_chk(zap_eq,0x0u,signed char,"%hhi")
- zaptest_chk(zap_lt < zap_eq,0x1u,unsigned char,"%hhX")
- zaptest_chk(zap_gt > zap_eq,0x1u,unsigned char,"%hhX")
- return false;
-}
diff --git a/test/source/test/memcnt.i b/test/source/test/memcnt.i
deleted file mode 100644
index 2e333f0..0000000
--- a/test/source/test/memcnt.i
+++ /dev/null
@@ -1,28 +0,0 @@
-#include <stdbool.h>
-
-static zap_bool memcntfn(void const * const _ptr) {
- unsigned int const * ptr = _ptr;
- if (*ptr & 0x1u) {
- return zap_false;
- }
- return zap_true;
-}
-
-static bool zaptest_test_memcnt(void) {
- unsigned int arr[] = {
- 0x0u,
- 0x1u,
- 0x2u,
- 0x3u,
- 0x4u,
- 0x5u,
- 0x6u,
- 0x7u,
- };
- zap_sz num = zap_memcnt(arr,sizeof (arr[0x0u]),sizeof (arr) / sizeof (arr[0x0u]),memcntfn);
- zaptest_chk(num,0x4u,zap_sz,"%zX");
- arr[0x0u] = 0x1u;
- num = zap_memcnt(arr,sizeof (arr[0x0u]),sizeof (arr) / sizeof (arr[0x0u]),memcntfn);
- zaptest_chk(num,0x3u,zap_sz,"%zX");
- return false;
-}
diff --git a/test/source/test/memcp.i b/test/source/test/memcp.i
deleted file mode 100644
index 4cfc17c..0000000
--- a/test/source/test/memcp.i
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <inttypes.h>
-#include <stdbool.h>
-
-static bool zaptest_test_memcp(void) {
- unsigned int arr[] = {
- 0xA5D0u,
- 0x98FFu,
- 0xA29Au,
- 0x910Cu,
- };
- unsigned int buf[sizeof (arr) / sizeof (arr[0x0u])];
- zap_memcp(arr,sizeof (arr),buf);
- zaptest_chk(buf[0x0u],0xA5D0u,unsigned int,"%X");
- zaptest_chk(buf[0x1u],0x98FFu,unsigned int,"%X");
- zaptest_chk(buf[0x2u],0xA29Au,unsigned int,"%X");
- zaptest_chk(buf[0x3u],0x910Cu,unsigned int,"%X");
- return false;
-}
diff --git a/test/source/test/memeq.i b/test/source/test/memeq.i
deleted file mode 100644
index d9de72f..0000000
--- a/test/source/test/memeq.i
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <stdbool.h>
-
-static bool zaptest_test_memeq(void) {
- unsigned char const arr0[] = {
- 0xFFu,
- 0x7Fu,
- 0x3Fu,
- };
- unsigned char const arr1[] = {
- 0xFFu,
- 0x7Fu,
- 0xFFu,
- };
- unsigned char const arr2[] = {
- 0xFFu,
- 0x7Fu,
- 0x3Fu,
- };
- zap_cmp eq = zap_memeq(arr0,sizeof (arr0),arr1);
- zaptest_chk(eq,zap_false,unsigned char,"%hhX")
- eq = zap_memeq(arr0,sizeof (arr0),arr2);
- zaptest_chk(eq,zap_true,unsigned char,"%hhX")
- return false;
-}
diff --git a/test/source/test/memfill.i b/test/source/test/memfill.i
deleted file mode 100644
index 9cb4d6e..0000000
--- a/test/source/test/memfill.i
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <stdbool.h>
-
-static bool zaptest_test_memfill(void) {
- unsigned long arr[0x4u];
- zap_memfill(arr,sizeof (arr),0x7Fu);
- arr[0x0u] &= 0xFFFFFFFFFFFFFFFFu;
- arr[0x1u] &= 0xFFFFFFFFFFFFFFFFu;
- arr[0x2u] &= 0xFFFFFFFFFFFFFFFFu;
- arr[0x3u] &= 0xFFFFFFFFFFFFFFFFu;
- zaptest_chk(arr[0x0u],0x7F7F7F7F7F7F7F7Fu,unsigned long,"%lX");
- zaptest_chk(arr[0x1u],0x7F7F7F7F7F7F7F7Fu,unsigned long,"%lX");
- zaptest_chk(arr[0x2u],0x7F7F7F7F7F7F7F7Fu,unsigned long,"%lX");
- zaptest_chk(arr[0x3u],0x7F7F7F7F7F7F7F7Fu,unsigned long,"%lX");
- zap_memfill(arr + 0x1u,sizeof (arr) - sizeof (arr[0x0u]),0x3Fu);
- arr[0x1u] &= 0xFFFFFFFFFFFFFFFFu;
- arr[0x2u] &= 0xFFFFFFFFFFFFFFFFu;
- arr[0x3u] &= 0xFFFFFFFFFFFFFFFFu;
- zaptest_chk(arr[0x0u],0x7F7F7F7F7F7F7F7Fu,unsigned long,"%lX");
- zaptest_chk(arr[0x1u],0x3F3F3F3F3F3F3F3Fu,unsigned long,"%lX");
- zaptest_chk(arr[0x2u],0x3F3F3F3F3F3F3F3Fu,unsigned long,"%lX");
- zaptest_chk(arr[0x3u],0x3F3F3F3F3F3F3F3Fu,unsigned long,"%lX");
- return false;
-}
diff --git a/test/source/test/memfnd.i b/test/source/test/memfnd.i
deleted file mode 100644
index 50923c6..0000000
--- a/test/source/test/memfnd.i
+++ /dev/null
@@ -1,33 +0,0 @@
-#include <stdbool.h>
-
-static bool zaptest_test_memfnd(void) {
- unsigned char const arr[] = {
- 0x1u,
- 0x3u,
- 0x7u,
- 0xFu,
- 0x1Fu,
- 0x3Fu,
- 0x7Fu,
- 0xFFu,
- };
- zap_sz pos = zap_memfnd(arr,sizeof (arr),0x1u);
- zaptest_chk(pos,0x0u,zap_sz,"%zX");
- pos = zap_memfnd(arr,sizeof (arr),0x3u);
- zaptest_chk(pos,0x1u,zap_sz,"%zX");
- pos = zap_memfnd(arr,sizeof (arr),0x7u);
- zaptest_chk(pos,0x2u,zap_sz,"%zX");
- pos = zap_memfnd(arr,sizeof (arr),0xFu);
- zaptest_chk(pos,0x3u,zap_sz,"%zX");
- pos = zap_memfnd(arr,sizeof (arr),0x1Fu);
- zaptest_chk(pos,0x4u,zap_sz,"%zX");
- pos = zap_memfnd(arr,sizeof (arr),0x3Fu);
- zaptest_chk(pos,0x5u,zap_sz,"%zX");
- pos = zap_memfnd(arr,sizeof (arr),0x7Fu);
- zaptest_chk(pos,0x6u,zap_sz,"%zX");
- pos = zap_memfnd(arr,sizeof (arr),0xFFu);
- zaptest_chk(pos,0x7u,zap_sz,"%zX");
- pos = zap_memfnd(arr,sizeof (arr),0xFEu);
- zaptest_chk(pos,zap_nopos,zap_sz,"%zX");
- return false;
-}
diff --git a/test/source/test/memfor.i b/test/source/test/memfor.i
deleted file mode 100644
index 0d6768e..0000000
--- a/test/source/test/memfor.i
+++ /dev/null
@@ -1,23 +0,0 @@
-#include <stdbool.h>
-
-static void memforfn(void * const _ptr) {
- unsigned int * ptr = _ptr;
- unsigned int val = *ptr;
- val %= 0x2;
- *ptr = val;
-}
-
-static bool zaptest_test_memfor(void) {
- unsigned int arr[] = {
- 0x0u,
- 0x1u,
- 0x2u,
- 0x3u,
- };
- zap_memfor(arr,sizeof (arr[0x0u]),sizeof (arr) / sizeof (arr[0x0u]),memforfn);
- zaptest_chk(arr[0x0u],0x0u,unsigned int,"%X");
- zaptest_chk(arr[0x1u],0x1u,unsigned int,"%X");
- zaptest_chk(arr[0x2u],0x0u,unsigned int,"%X");
- zaptest_chk(arr[0x3u],0x1u,unsigned int,"%X");
- return false;
-}
diff --git a/test/source/test/memgen.i b/test/source/test/memgen.i
deleted file mode 100644
index dcc7c69..0000000
--- a/test/source/test/memgen.i
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <stdbool.h>
-#include <stddef.h>
-
-static unsigned long zaptest_fib(zap_sz const _num) {
- if (_num <= 0x1u) {
- if (_num == 0x0u) {return 0x0u;}
- return 0x1u;
- }
- return zaptest_fib(_num - 0x1u) + zaptest_fib(_num - 0x2u);
-}
-
-static void zatest_memgenfn(zap_sz const _num,void * const _ptr) {
- unsigned long * ptr = _ptr;
- *ptr = zaptest_fib(_num);
-}
-
-static bool zaptest_test_memgen(void) {
- unsigned long arr[0x8u];
- zap_memgen(arr,sizeof (arr[0x0u]),sizeof (arr) / sizeof (arr[0x0u]),zatest_memgenfn);
- zaptest_chk(arr[0x0u],0x0u,unsigned long,"%lX");
- zaptest_chk(arr[0x1u],0x1u,unsigned long,"%lX");
- zaptest_chk(arr[0x2u],0x1u,unsigned long,"%lX");
- zaptest_chk(arr[0x3u],0x2u,unsigned long,"%lX");
- zaptest_chk(arr[0x4u],0x3u,unsigned long,"%lX");
- zaptest_chk(arr[0x5u],0x5u,unsigned long,"%lX");
- zaptest_chk(arr[0x6u],0x8u,unsigned long,"%lX");
- zaptest_chk(arr[0x7u],0xDu,unsigned long,"%lX");
- return false;
-}
diff --git a/test/source/test/nullptr.i b/test/source/test/nullptr.i
deleted file mode 100644
index 00b49bd..0000000
--- a/test/source/test/nullptr.i
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <stdbool.h>
-#include <stddef.h>
-
-static bool zaptest_test_nullptr(void) {
- zaptest_chk((void *)zap_nullptr,(void *)NULL,void *,"%p")
- return false;
-}
diff --git a/test/source/test/strcp.i b/test/source/test/strcp.i
deleted file mode 100644
index cd878c9..0000000
--- a/test/source/test/strcp.i
+++ /dev/null
@@ -1,42 +0,0 @@
-#include <stdbool.h>
-
-static bool zaptest_test_strcp(void) {
- char const str[] = "What in the world are you doing?";
- zaptest_log(str,char const *,"%s")
- char buf[sizeof (str)];
- zap_strcp(str,buf);
- zaptest_chk(buf[0x0u], 'W', char,"'%c'")
- zaptest_chk(buf[0x1u], 'h', char,"'%c'")
- zaptest_chk(buf[0x2u], 'a', char,"'%c'")
- zaptest_chk(buf[0x3u], 't', char,"'%c'")
- zaptest_chk(buf[0x4u], ' ', char,"'%c'")
- zaptest_chk(buf[0x5u], 'i', char,"'%c'")
- zaptest_chk(buf[0x6u], 'n', char,"'%c'")
- zaptest_chk(buf[0x7u], ' ', char,"'%c'")
- zaptest_chk(buf[0x8u], 't', char,"'%c'")
- zaptest_chk(buf[0x9u], 'h', char,"'%c'")
- zaptest_chk(buf[0xAu], 'e', char,"'%c'")
- zaptest_chk(buf[0xBu], ' ', char,"'%c'")
- zaptest_chk(buf[0xCu], 'w', char,"'%c'")
- zaptest_chk(buf[0xDu], 'o', char,"'%c'")
- zaptest_chk(buf[0xEu], 'r', char,"'%c'")
- zaptest_chk(buf[0xFu], 'l', char,"'%c'")
- zaptest_chk(buf[0x10u],'d', char,"'%c'")
- zaptest_chk(buf[0x11u],' ', char,"'%c'")
- zaptest_chk(buf[0x12u],'a', char,"'%c'")
- zaptest_chk(buf[0x13u],'r', char,"'%c'")
- zaptest_chk(buf[0x14u],'e', char,"'%c'")
- zaptest_chk(buf[0x15u],' ', char,"'%c'")
- zaptest_chk(buf[0x16u],'y', char,"'%c'")
- zaptest_chk(buf[0x17u],'o', char,"'%c'")
- zaptest_chk(buf[0x18u],'u', char,"'%c'")
- zaptest_chk(buf[0x19u],' ', char,"'%c'")
- zaptest_chk(buf[0x1Au],'d', char,"'%c'")
- zaptest_chk(buf[0x1Bu],'o', char,"'%c'")
- zaptest_chk(buf[0x1Cu],'i', char,"'%c'")
- zaptest_chk(buf[0x1Du],'n', char,"'%c'")
- zaptest_chk(buf[0x1Eu],'g', char,"'%c'")
- zaptest_chk(buf[0x1Fu],'?', char,"'%c'")
- zaptest_chk(buf[0x20u],'\x0',char,"'%c'")
- return false;
-}
diff --git a/test/source/test/streq.i b/test/source/test/streq.i
deleted file mode 100644
index 62ed186..0000000
--- a/test/source/test/streq.i
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <stdbool.h>
-
-static bool zaptest_test_streq(void) {
- char const str0[] = "What's up, my guy?";
- char const str1[] = "What's up, my guy?";
- char const str2[] = "I don't know you!";
- char const str3[] = "I don't know you! Or do I?";
- zaptest_log(str0,char const *,"%s")
- zaptest_log(str1,char const *,"%s")
- zaptest_log(str2,char const *,"%s")
- zaptest_log(str3,char const *,"%s")
- zap_bool eq0 = zap_streq(str0,str1);
- zap_bool eq1 = zap_streq(str0,str2);
- zap_bool eq2 = zap_streq(str1,str2);
- zap_bool eq3 = zap_streq(str2,str3);
- zaptest_chk(eq0,zap_true, unsigned char,"%hhX");
- zaptest_chk(eq1,zap_false,unsigned char,"%hhX");
- zaptest_chk(eq2,zap_false,unsigned char,"%hhX");
- zaptest_chk(eq3,zap_false,unsigned char,"%hhX");
- return false;
-}
diff --git a/test/source/test/strfill.i b/test/source/test/strfill.i
deleted file mode 100644
index 1e2764c..0000000
--- a/test/source/test/strfill.i
+++ /dev/null
@@ -1,18 +0,0 @@
-#include <stdbool.h>
-
-static bool zaptest_test_strfill(void) {
- char str[] = {
- 'H',
- 'e',
- 'y',
- '!',
- '\x0',
- };
- zap_strfill(str,'&');
- zaptest_chk(str[0x0u],'&', char,"'%c'");
- zaptest_chk(str[0x1u],'&', char,"'%c'");
- zaptest_chk(str[0x2u],'&', char,"'%c'");
- zaptest_chk(str[0x3u],'&', char,"'%c'");
- zaptest_chk(str[0x4u],'\x0',char,"'%c'");
- return false;
-}
diff --git a/test/source/test/strfnd.i b/test/source/test/strfnd.i
deleted file mode 100644
index a85f227..0000000
--- a/test/source/test/strfnd.i
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <stdbool.h>
-
-static bool zaptest_test_strfnd(void) {
- char const str[] = "What the drake doing?";
- zap_sz pos = zap_strfnd(str,'?');
- zaptest_chk(pos,0x14u,zap_sz,"%zX");
- pos = zap_strfnd(str,'t');
- zaptest_chk(pos,0x3u,zap_sz,"%zX");
- pos = zap_strfnd(str,'!');
- zaptest_chk(pos,zap_nopos,zap_sz,"%zX");
- return false;
-}
diff --git a/test/source/test/strlen.i b/test/source/test/strlen.i
deleted file mode 100644
index 93bec76..0000000
--- a/test/source/test/strlen.i
+++ /dev/null
@@ -1,13 +0,0 @@
-#include <stdbool.h>
-
-bool zaptest_test_strlen(void) {
- char const str0[] = "Hello there! General Kenobi?";
- char const str1[] = "Hello there! General Gayballs?";
- zaptest_log(str0,char const *,"%s")
- zaptest_log(str1,char const *,"%s")
- zap_sz const len0 = zap_strlen(str0);
- zap_sz const len1 = zap_strlen(str1);
- zaptest_chk(len0,0x1Cu,zap_sz,"%zX")
- zaptest_chk(len1,0x1Eu,zap_sz,"%zX")
- return false;
-}
diff --git a/test/source/test/utf20len.i b/test/source/test/utf20len.i
deleted file mode 100644
index 98be658..0000000
--- a/test/source/test/utf20len.i
+++ /dev/null
@@ -1,11 +0,0 @@
-#include <stdbool.h>
-
-bool zaptest_test_utf20len(void) {
- zap_chr20 const str0[] = U"Ça va?";
- zap_chr20 const str1[] = U"Non, ça ne va pas.";
- zap_sz const len0 = zap_utf20len(str0);
- zap_sz const len1 = zap_utf20len(str1);
- zaptest_chk(len0,0x6u,zap_sz,"%zX")
- zaptest_chk(len1,0x12u,zap_sz,"%zX")
- return false;
-}
diff --git a/test/source/test/utf8dec.i b/test/source/test/utf8dec.i
deleted file mode 100644
index fdea169..0000000
--- a/test/source/test/utf8dec.i
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <inttypes.h>
-#include <stdbool.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-static bool zaptest_test_utf8dec(void) {
- zap_chr8 const utf8[] = {
- 0x26u,
- 0xC3u,
- 0xB0u,
- 0xE0u,
- 0xB6u,
- 0x9Eu,
- 0xE2u,
- 0x86u,
- 0x8Au,
- 0xE2u,
- 0x86u,
- 0x8Bu,
- 0xF0u,
- 0x9Fu,
- 0x97u,
- 0xBFu,
- 0x0u,
- };
- zap_sz const enclen = zap_utf8declen(utf8);
- zaptest_chk(enclen,0x6u,zap_sz,"%zX")
- zap_chr20 * const utf20 = malloc(sizeof (zap_chr20) * (enclen + 0x1u));
- if (utf20 == NULL) {
- fputs("test.utf8dec: Memory allocation failed!\n\n",stderr);
- return true;
- }
- zap_utf8dec(utf8,utf20);
- zaptest_chk(utf20[0x0u],0x26u, zap_chr20,"%" PRIXLEAST32)
- zaptest_chk(utf20[0x1u],0xF0u, zap_chr20,"%" PRIXLEAST32)
- zaptest_chk(utf20[0x2u],0xD9Eu, zap_chr20,"%" PRIXLEAST32)
- zaptest_chk(utf20[0x3u],0x218Au, zap_chr20,"%" PRIXLEAST32)
- zaptest_chk(utf20[0x4u],0x218Bu, zap_chr20,"%" PRIXLEAST32)
- zaptest_chk(utf20[0x5u],0x1F5FFu,zap_chr20,"%" PRIXLEAST32)
- zaptest_chk(utf20[0x6u],0x0u, zap_chr20,"%" PRIXLEAST32)
- free(utf20);
- return false;
-}
diff --git a/test/source/test/utf8enc.i b/test/source/test/utf8enc.i
deleted file mode 100644
index 8bc7abb..0000000
--- a/test/source/test/utf8enc.i
+++ /dev/null
@@ -1,42 +0,0 @@
-#include <stdbool.h>
-#include <stdlib.h>
-
-static bool zaptest_test_utf8enc(void) {
- zap_chr20 const utf20[] = {
- 0x26u,
- 0xF0u,
- 0xD9Eu,
- 0x218Au,
- 0x218Bu,
- 0x1F5FFu,
- 0x0u,
- };
- zap_sz const enclen = zap_utf8enclen(utf20);
- zaptest_chk(enclen,0x10u,zap_sz,"%zX")
- zap_chr8 * const utf8 = malloc(enclen + 0x1u);
- if (utf8 == NULL) {
- fputs("test.utf8enc: Memory allocation failed!\n\n",stderr);
- return true;
- }
- zap_utf8enc(utf20,utf8);
- zaptest_log(utf8,char const *,"%s") /* UB? */
- zaptest_chk(utf8[0x0u], 0x26u,unsigned char,"%hhX")
- zaptest_chk(utf8[0x1u], 0xC3u,unsigned char,"%hhX")
- zaptest_chk(utf8[0x2u], 0xB0u,unsigned char,"%hhX")
- zaptest_chk(utf8[0x3u], 0xE0u,unsigned char,"%hhX")
- zaptest_chk(utf8[0x4u], 0xB6u,unsigned char,"%hhX")
- zaptest_chk(utf8[0x5u], 0x9Eu,unsigned char,"%hhX")
- zaptest_chk(utf8[0x6u], 0xE2u,unsigned char,"%hhX")
- zaptest_chk(utf8[0x7u], 0x86u,unsigned char,"%hhX")
- zaptest_chk(utf8[0x8u], 0x8Au,unsigned char,"%hhX")
- zaptest_chk(utf8[0x9u], 0xE2u,unsigned char,"%hhX")
- zaptest_chk(utf8[0xAu], 0x86u,unsigned char,"%hhX")
- zaptest_chk(utf8[0xBu], 0x8Bu,unsigned char,"%hhX")
- zaptest_chk(utf8[0xCu], 0xF0u,unsigned char,"%hhX")
- zaptest_chk(utf8[0xDu], 0x9Fu,unsigned char,"%hhX")
- zaptest_chk(utf8[0xEu], 0x97u,unsigned char,"%hhX")
- zaptest_chk(utf8[0xFu], 0xBFu,unsigned char,"%hhX")
- zaptest_chk(utf8[0x10u],0x0u, unsigned char,"%hhX")
- free(utf8);
- return false;
-}
diff --git a/test/source/test/win1252dec.i b/test/source/test/win1252dec.i
deleted file mode 100644
index f1adf03..0000000
--- a/test/source/test/win1252dec.i
+++ /dev/null
@@ -1,77 +0,0 @@
-#include <inttypes.h>
-#include <stdbool.h>
-
-static bool zaptest_test_win1252dec(void) {
- zap_chr8 const win1252[] = {
- 0x26u,
- 0xF0u,
- 0x80u,
- 0x82u,
- 0x83u,
- 0x84u,
- 0x85u,
- 0x86u,
- 0x87u,
- 0x88u,
- 0x89u,
- 0x8Au,
- 0x8Bu,
- 0x8Cu,
- 0x8Eu,
- 0x91u,
- 0x92u,
- 0x93u,
- 0x94u,
- 0x95u,
- 0x96u,
- 0x97u,
- 0x98u,
- 0x99u,
- 0x9Au,
- 0x9Bu,
- 0x9Cu,
- 0x9Eu,
- 0x9Fu,
- 0x0u,
- };
- zap_sz const enclen = sizeof (win1252) - 0x1u;
- zaptest_chk(enclen,0x1Du,zap_sz,"%zX")
- zap_chr20 * const utf20 = malloc(sizeof (zap_chr20) * (enclen + 0x1u));
- if (utf20 == NULL) {
- fputs("test.win1252dec: Memory allocation failed!\n\n",stderr);
- return true;
- }
- zap_win1252dec(win1252,utf20);
- zaptest_chk(utf20[0x0u], 0x26u, zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0x1u], 0xF0u, zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0x2u], 0x20ACu,zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0x3u], 0x201Au,zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0x4u], 0x192u, zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0x5u], 0x201Eu,zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0x6u], 0x2026u,zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0x7u], 0x2020u,zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0x8u], 0x2021u,zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0x9u], 0x2C6u, zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0xAu], 0x2030u,zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0xBu], 0x160u, zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0xCu], 0x2039u,zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0xDu], 0x152u, zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0xEu], 0x17Du, zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0xFu], 0x2018u,zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0x10u],0x2019u,zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0x11u],0x201Cu,zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0x12u],0x201Du,zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0x13u],0x2022u,zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0x14u],0x2013u,zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0x15u],0x2014u,zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0x16u],0x2DCu, zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0x17u],0x2122u,zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0x18u],0x161u, zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0x19u],0x203Au,zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0x1Au],0x153u, zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0x1Bu],0x17Eu, zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0x1Cu],0x178u, zap_chr20,"%" PRIXLEAST32);
- zaptest_chk(utf20[0x1Du],0x0u, zap_chr20,"%" PRIXLEAST32);
- free(utf20);
- return false;
-}
diff --git a/test/source/test/win1252enc.i b/test/source/test/win1252enc.i
deleted file mode 100644
index f9f258e..0000000
--- a/test/source/test/win1252enc.i
+++ /dev/null
@@ -1,77 +0,0 @@
-#include <stdbool.h>
-
-static bool zaptest_test_win1252enc(void) {
- zap_chr20 const utf20[] = {
- 0x26u,
- 0xF0u,
- 0x20ACu,
- 0x201Au,
- 0x192u,
- 0x201Eu,
- 0x2026u,
- 0x2020u,
- 0x2021u,
- 0x2C6u,
- 0x2030u,
- 0x160u,
- 0x2039u,
- 0x152u,
- 0x17Du,
- 0x2018u,
- 0x2019u,
- 0x201Cu,
- 0x201Du,
- 0x2022u,
- 0x2013u,
- 0x2014u,
- 0x2DCu,
- 0x2122u,
- 0x161u,
- 0x203Au,
- 0x153u,
- 0x17Eu,
- 0x178u,
- 0x0u,
- };
- zap_sz const enclen = sizeof (utf20) / sizeof (utf20[0x0u]) - 0x1u;
- zaptest_chk(enclen,0x1Du,zap_sz,"%zX")
- zap_chr8 * const win1252 = malloc(enclen + 0x1u);
- if (win1252 == NULL) {
- fputs("test.win1252enc: Memory allocation failed!\n\n",stderr);
- return true;
- }
- zap_win1252enc(utf20,win1252);
- zaptest_log(win1252,char const *,"%s"); /* UB? */
- zaptest_chk(win1252[0x0u], 0x26u,unsigned char,"%hhX");
- zaptest_chk(win1252[0x1u], 0xF0u,unsigned char,"%hhX");
- zaptest_chk(win1252[0x2u], 0x80u,unsigned char,"%hhX");
- zaptest_chk(win1252[0x3u], 0x82u,unsigned char,"%hhX");
- zaptest_chk(win1252[0x4u], 0x83u,unsigned char,"%hhX");
- zaptest_chk(win1252[0x5u], 0x84u,unsigned char,"%hhX");
- zaptest_chk(win1252[0x6u], 0x85u,unsigned char,"%hhX");
- zaptest_chk(win1252[0x7u], 0x86u,unsigned char,"%hhX");
- zaptest_chk(win1252[0x8u], 0x87u,unsigned char,"%hhX");
- zaptest_chk(win1252[0x9u], 0x88u,unsigned char,"%hhX");
- zaptest_chk(win1252[0xAu], 0x89u,unsigned char,"%hhX");
- zaptest_chk(win1252[0xBu], 0x8Au,unsigned char,"%hhX");
- zaptest_chk(win1252[0xCu], 0x8Bu,unsigned char,"%hhX");
- zaptest_chk(win1252[0xDu], 0x8Cu,unsigned char,"%hhX");
- zaptest_chk(win1252[0xEu], 0x8Eu,unsigned char,"%hhX");
- zaptest_chk(win1252[0xFu], 0x91u,unsigned char,"%hhX");
- zaptest_chk(win1252[0x10u],0x92u,unsigned char,"%hhX");
- zaptest_chk(win1252[0x11u],0x93u,unsigned char,"%hhX");
- zaptest_chk(win1252[0x12u],0x94u,unsigned char,"%hhX");
- zaptest_chk(win1252[0x13u],0x95u,unsigned char,"%hhX");
- zaptest_chk(win1252[0x14u],0x96u,unsigned char,"%hhX");
- zaptest_chk(win1252[0x15u],0x97u,unsigned char,"%hhX");
- zaptest_chk(win1252[0x16u],0x98u,unsigned char,"%hhX");
- zaptest_chk(win1252[0x17u],0x99u,unsigned char,"%hhX");
- zaptest_chk(win1252[0x18u],0x9Au,unsigned char,"%hhX");
- zaptest_chk(win1252[0x19u],0x9Bu,unsigned char,"%hhX");
- zaptest_chk(win1252[0x1Au],0x9Cu,unsigned char,"%hhX");
- zaptest_chk(win1252[0x1Bu],0x9Eu,unsigned char,"%hhX");
- zaptest_chk(win1252[0x1Cu],0x9Fu,unsigned char,"%hhX");
- zaptest_chk(win1252[0x1Du],0x0u, unsigned char,"%hhX");
- free(win1252);
- return false;
-}