More docs. And test put_filter

This commit is contained in:
Nils O. Selåsdal
2013-12-04 20:44:47 +01:00
parent 8749270ca4
commit d81e9b760a
2 changed files with 30 additions and 6 deletions
+17
View File
@@ -1,4 +1,5 @@
#include <check.h>
#include <ctype.h>
#include <ucore/dstr.h>
#include <ucore/utils.h>
@@ -107,6 +108,21 @@ START_TEST (test_dstr_replace)
END_TEST
START_TEST (test_dstr_filter)
struct DStr str;
size_t rc;
uc_dstr_init(&str);
uc_dstr_put_str(&str, "AB:");
rc = uc_dstr_put_str_filter(&str, "1:2,3 4 ", isdigit);
ck_assert_int_eq(rc, 4);
ck_assert_str_eq(uc_dstr_str(&str), "AB:1234");
uc_dstr_destroy(&str);
END_TEST
Suite *dstr_suite(void)
{
Suite *s = suite_create("dstr");
@@ -115,6 +131,7 @@ Suite *dstr_suite(void)
tcase_add_test(tc, test_dstr_own_steal);
tcase_add_test(tc, test_dstr_trim);
tcase_add_test(tc, test_dstr_replace);
tcase_add_test(tc, test_dstr_filter);
suite_add_tcase(s, tc);