diff options
author | David Timber <mieabby@gmail.com> | 2021-07-12 16:16:22 +1000 |
---|---|---|
committer | David Timber <mieabby@gmail.com> | 2021-07-12 16:16:22 +1000 |
commit | 15bde4c46b707f7a95c7ea6650a3f02d67e50530 (patch) | |
tree | 1aa069521941a41171302dba837d57d35a2d9e41 /src/proone-test_util.c | |
parent | 3fbf08ab6522c91e8209b21d66430a2db4ea71cb (diff) |
Impl proone-htbtclient, bugfix, --enable-mttools
* Remove --enable-hostinfod and add --enable-mttools, which enables
hostinfod and htbtclient
* Change PRNE_HTBT_PROTO_PORT so that the macro can be used in another
macro expression(for help message)
* Add prne_mbedtls_perror()
* proone-htbtclient: implement hostinfo command
* proone-htbthost
* Add --hostcred option
* Response with status frame on ENOMEM
* htbt: add prne_htbt_serrc_tostr() and prne_htbt_gen_msgid()
* Add prne_ctoupper(), prne_ctolower(), prne_cisspace(), prne_cisprint()
* The added functions are the locale-independent equivalent of their
POSIX counterparts
* Remove Use of the POSIX functions
* Add test unit
Diffstat (limited to 'src/proone-test_util.c')
-rw-r--r-- | src/proone-test_util.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/proone-test_util.c b/src/proone-test_util.c index c704d70..a5a88db 100644 --- a/src/proone-test_util.c +++ b/src/proone-test_util.c @@ -4,15 +4,19 @@ #include <assert.h> #include <string.h> #include <errno.h> +#include <ctype.h> +#include <locale.h> static void test_uuid (void); static void test_alloc (void); static void test_str (void); +static void test_cc (void); int main (void) { test_alloc(); test_str(); + test_cc(); test_uuid(); return 0; @@ -152,3 +156,14 @@ static void test_uuid (void) { out_arr)); assert(errno == EINVAL); } + +static void test_cc (void) { + for (int i = 1; i <= 127; i += 1) { + const char c = (char)i; + + assert(prne_ctoupper(c) == toupper(c)); + assert(prne_ctolower(c) == tolower(c)); + assert(prne_cisspace(c) == (isspace(c) != 0)); + assert(prne_cisprint(c) == (isprint(c) != 0)); + } +} |