diff options
author | Vincent Sanders <vince@kyllikki.org> | 2016-08-14 23:49:53 +0100 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2016-08-14 23:49:53 +0100 |
commit | 02360ec7be6b061513f07638d015da066afef7dc (patch) | |
tree | 6fdb8232420102d0185a700bebe414afd879e36b /test | |
parent | 0e5824c8e851ee6fd29868eddd3be2b738f3351e (diff) | |
download | netsurf-02360ec7be6b061513f07638d015da066afef7dc.tar.gz netsurf-02360ec7be6b061513f07638d015da066afef7dc.tar.bz2 |
add some corestrings API tests and fix corestrings fini.
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile | 1 | ||||
-rw-r--r-- | test/utils.c | 54 |
2 files changed, 55 insertions, 0 deletions
diff --git a/test/Makefile b/test/Makefile index d62e2fd8d..a3f84f35a 100644 --- a/test/Makefile +++ b/test/Makefile @@ -51,6 +51,7 @@ urlescape_SRCS := utils/url.c test/log.c test/urlescape.c # utility test sources utils_SRCS := utils/utils.c utils/messages.c utils/hashtable.c \ + utils/corestrings.c utils/nsurl.c utils/idna.c \ test/log.c test/utils.c # time test sources diff --git a/test/utils.c b/test/utils.c index e00ab3dc4..62ccf512d 100644 --- a/test/utils.c +++ b/test/utils.c @@ -29,6 +29,7 @@ #include <check.h> #include "utils/string.h" +#include "utils/corestrings.h" #define NELEMS(x) (sizeof(x) / sizeof((x)[0])) #define SLEN(x) (sizeof((x)) - 1) @@ -128,6 +129,58 @@ static TCase *squash_whitespace_case_create(void) return tc; } + +START_TEST(corestrings_init_fini_test) +{ + nserror res; + + res = corestrings_init(); + ck_assert_int_eq(res, NSERROR_OK); + + corestrings_fini(); +} +END_TEST + +START_TEST(corestrings_double_init_test) +{ + nserror res; + + res = corestrings_init(); + ck_assert_int_eq(res, NSERROR_OK); + + res = corestrings_init(); + ck_assert_int_eq(res, NSERROR_OK); + + corestrings_fini(); +} +END_TEST + +START_TEST(corestrings_double_fini_test) +{ + nserror res; + + res = corestrings_init(); + ck_assert_int_eq(res, NSERROR_OK); + + corestrings_fini(); + + corestrings_fini(); +} +END_TEST + + +static TCase *corestrings_case_create(void) +{ + TCase *tc; + tc = tcase_create("Corestrings"); + + tcase_add_test(tc, corestrings_init_fini_test); + tcase_add_test(tc, corestrings_double_init_test); + tcase_add_test(tc, corestrings_double_fini_test); + + return tc; +} + static Suite *utils_suite_create(void) { Suite *s; @@ -135,6 +188,7 @@ static Suite *utils_suite_create(void) suite_add_tcase(s, human_friendly_bytesize_case_create()); suite_add_tcase(s, squash_whitespace_case_create()); + suite_add_tcase(s, corestrings_case_create()); return s; } |