diff options
| author | allusive-dev <[email protected]> | 2023-11-18 08:21:51 +1100 |
|---|---|---|
| committer | allusive-dev <[email protected]> | 2023-11-18 08:21:51 +1100 |
| commit | be87e3336f7f897db5e089d673d2a288ff783af9 (patch) | |
| tree | e5fbf0a2c3f49e99d0aeddaf510b6ae4ee918e2d /src/string_utils.c | |
| parent | update contributors (diff) | |
| download | compfy-1.7.1.tar.xz compfy-1.7.1.zip | |
deprecate sub-projects and testing1.7.1
Diffstat (limited to 'src/string_utils.c')
| -rw-r--r-- | src/string_utils.c | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/src/string_utils.c b/src/string_utils.c index ee5bb2d..871f29a 100644 --- a/src/string_utils.c +++ b/src/string_utils.c @@ -3,8 +3,6 @@ #include <string.h> -#include <test.h> - #include "compiler.h" #include "string_utils.h" #include "utils.h" @@ -35,20 +33,6 @@ char *mstrjoin(const char *src1, const char *src2) { return str; } -TEST_CASE(mstrjoin) { - char *str = mstrjoin("asdf", "qwer"); - TEST_STREQUAL(str, "asdfqwer"); - free(str); - - str = mstrjoin("", "qwer"); - TEST_STREQUAL(str, "qwer"); - free(str); - - str = mstrjoin("asdf", ""); - TEST_STREQUAL(str, "asdf"); - free(str); -} - /** * Concatenate a string on heap with another string. */ @@ -67,19 +51,6 @@ void mstrextend(char **psrc1, const char *src2) { (*psrc1)[len - 1] = '\0'; } -TEST_CASE(mstrextend) { - char *str1 = NULL; - mstrextend(&str1, "asdf"); - TEST_STREQUAL(str1, "asdf"); - - mstrextend(&str1, "asd"); - TEST_STREQUAL(str1, "asdfasd"); - - mstrextend(&str1, ""); - TEST_STREQUAL(str1, "asdfasd"); - free(str1); -} - #pragma GCC diagnostic pop /// Parse a floating point number of form (+|-)?[0-9]*(\.[0-9]*) @@ -113,21 +84,6 @@ double strtod_simple(const char *src, const char **end) { return ret * neg; } -TEST_CASE(strtod_simple) { - const char *end; - double result = strtod_simple("1.0", &end); - TEST_EQUAL(result, 1); - TEST_EQUAL(*end, '\0'); - - result = strtod_simple("-1.0", &end); - TEST_EQUAL(result, -1); - TEST_EQUAL(*end, '\0'); - - result = strtod_simple("+.5", &end); - TEST_EQUAL(result, 0.5); - TEST_EQUAL(*end, '\0'); -} - const char *trim_both(const char *src, size_t *length) { size_t i = 0; while (isspace(src[i])) { @@ -140,18 +96,3 @@ const char *trim_both(const char *src, size_t *length) { *length = j - i + 1; return src + i; } - -TEST_CASE(trim_both) { - size_t length; - const char *str = trim_both(" \t\n\r\f", &length); - TEST_EQUAL(length, 0); - TEST_EQUAL(*str, '\0'); - - str = trim_both(" asdfas ", &length); - TEST_EQUAL(length, 6); - TEST_STRNEQUAL(str, "asdfas", length); - - str = trim_both(" asdf asdf ", &length); - TEST_EQUAL(length, 9); - TEST_STRNEQUAL(str, "asdf asdf", length); -} |