aboutsummaryrefslogtreecommitdiffstats
path: root/tests/common
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2016-09-03 20:42:17 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2016-09-03 20:42:17 +0200
commita319fe44f6d50d25f546e17ad9907eedd9a358a0 (patch)
tree4fdca76c71af9cc78ae2683fa3d8a1589a78d71c /tests/common
parent6c5adce7b557c696cb6b5a5ebd4cd1e9380ac419 (diff)
downloadblogc-a319fe44f6d50d25f546e17ad9907eedd9a358a0.tar.gz
blogc-a319fe44f6d50d25f546e17ad9907eedd9a358a0.tar.bz2
blogc-a319fe44f6d50d25f546e17ad9907eedd9a358a0.zip
*: s/sb_/bc_/g
Diffstat (limited to 'tests/common')
-rw-r--r--tests/common/check_utf8.c24
-rw-r--r--tests/common/check_utils.c498
2 files changed, 261 insertions, 261 deletions
diff --git a/tests/common/check_utf8.c b/tests/common/check_utf8.c
index d104265..f4c7f32 100644
--- a/tests/common/check_utf8.c
+++ b/tests/common/check_utf8.c
@@ -45,30 +45,30 @@ test_utf8_invalid(void **state)
static void
test_utf8_valid_str(void **state)
{
- sb_string_t *s = sb_string_new();
- sb_string_append(s,
+ bc_string_t *s = bc_string_new();
+ bc_string_append(s,
"<a href=\"{{ BASE_URL }}/page/{{ PREVIOUS_PAGE }}/\">\xc2\xab Newer "
"posts</a>");
assert_true(blogc_utf8_validate_str(s));
- sb_string_free(s, true);
- s = sb_string_new();
- sb_string_append(s, "\xe2\x82\xac");
+ bc_string_free(s, true);
+ s = bc_string_new();
+ bc_string_append(s, "\xe2\x82\xac");
assert_true(blogc_utf8_validate_str(s));
- sb_string_free(s, true);
+ bc_string_free(s, true);
}
static void
test_utf8_invalid_str(void **state)
{
- sb_string_t *s = sb_string_new();
- sb_string_append(s, "\xff\xfe\xac\x20"); // utf-16
+ bc_string_t *s = bc_string_new();
+ bc_string_append(s, "\xff\xfe\xac\x20"); // utf-16
assert_false(blogc_utf8_validate_str(s));
- sb_string_free(s, true);
- s = sb_string_new();
- sb_string_append(s, "\xff\xfe\x00\x00\xac\x20\x00\x00"); // utf-32
+ bc_string_free(s, true);
+ s = bc_string_new();
+ bc_string_append(s, "\xff\xfe\x00\x00\xac\x20\x00\x00"); // utf-32
assert_false(blogc_utf8_validate_str(s));
- sb_string_free(s, true);
+ bc_string_free(s, true);
}
diff --git a/tests/common/check_utils.c b/tests/common/check_utils.c
index a9ec316..9d49434 100644
--- a/tests/common/check_utils.c
+++ b/tests/common/check_utils.c
@@ -20,50 +20,50 @@
static void
test_slist_append(void **state)
{
- sb_slist_t *l = NULL;
- l = sb_slist_append(l, (void*) sb_strdup("bola"));
+ bc_slist_t *l = NULL;
+ l = bc_slist_append(l, (void*) bc_strdup("bola"));
assert_non_null(l);
assert_string_equal(l->data, "bola");
assert_null(l->next);
- l = sb_slist_append(l, (void*) sb_strdup("guda"));
+ l = bc_slist_append(l, (void*) bc_strdup("guda"));
assert_non_null(l);
assert_string_equal(l->data, "bola");
assert_non_null(l->next);
assert_string_equal(l->next->data, "guda");
assert_null(l->next->next);
- sb_slist_free_full(l, free);
+ bc_slist_free_full(l, free);
}
static void
test_slist_prepend(void **state)
{
- sb_slist_t *l = NULL;
- l = sb_slist_prepend(l, (void*) sb_strdup("bola"));
+ bc_slist_t *l = NULL;
+ l = bc_slist_prepend(l, (void*) bc_strdup("bola"));
assert_non_null(l);
assert_string_equal(l->data, "bola");
assert_null(l->next);
- l = sb_slist_prepend(l, (void*) sb_strdup("guda"));
+ l = bc_slist_prepend(l, (void*) bc_strdup("guda"));
assert_non_null(l);
assert_string_equal(l->data, "guda");
assert_non_null(l->next);
assert_string_equal(l->next->data, "bola");
assert_null(l->next->next);
- sb_slist_free_full(l, free);
+ bc_slist_free_full(l, free);
}
static void
test_slist_free(void **state)
{
- sb_slist_t *l = NULL;
- char *t1 = sb_strdup("bola");
- char *t2 = sb_strdup("guda");
- char *t3 = sb_strdup("chunda");
- l = sb_slist_append(l, (void*) t1);
- l = sb_slist_append(l, (void*) t2);
- l = sb_slist_append(l, (void*) t3);
- sb_slist_free(l);
+ bc_slist_t *l = NULL;
+ char *t1 = bc_strdup("bola");
+ char *t2 = bc_strdup("guda");
+ char *t3 = bc_strdup("chunda");
+ l = bc_slist_append(l, (void*) t1);
+ l = bc_slist_append(l, (void*) t2);
+ l = bc_slist_append(l, (void*) t3);
+ bc_slist_free(l);
assert_string_equal(t1, "bola");
assert_string_equal(t2, "guda");
assert_string_equal(t3, "chunda");
@@ -76,23 +76,23 @@ test_slist_free(void **state)
static void
test_slist_length(void **state)
{
- sb_slist_t *l = NULL;
- l = sb_slist_append(l, (void*) sb_strdup("bola"));
- l = sb_slist_append(l, (void*) sb_strdup("guda"));
- l = sb_slist_append(l, (void*) sb_strdup("chunda"));
- assert_int_equal(sb_slist_length(l), 3);
- sb_slist_free_full(l, free);
- assert_int_equal(sb_slist_length(NULL), 0);
+ bc_slist_t *l = NULL;
+ l = bc_slist_append(l, (void*) bc_strdup("bola"));
+ l = bc_slist_append(l, (void*) bc_strdup("guda"));
+ l = bc_slist_append(l, (void*) bc_strdup("chunda"));
+ assert_int_equal(bc_slist_length(l), 3);
+ bc_slist_free_full(l, free);
+ assert_int_equal(bc_slist_length(NULL), 0);
}
static void
test_strdup(void **state)
{
- char *str = sb_strdup("bola");
+ char *str = bc_strdup("bola");
assert_string_equal(str, "bola");
free(str);
- str = sb_strdup(NULL);
+ str = bc_strdup(NULL);
assert_null(str);
}
@@ -100,16 +100,16 @@ test_strdup(void **state)
static void
test_strndup(void **state)
{
- char *str = sb_strndup("bolaguda", 4);
+ char *str = bc_strndup("bolaguda", 4);
assert_string_equal(str, "bola");
free(str);
- str = sb_strndup("bolaguda", 30);
+ str = bc_strndup("bolaguda", 30);
assert_string_equal(str, "bolaguda");
free(str);
- str = sb_strndup("bolaguda", 8);
+ str = bc_strndup("bolaguda", 8);
assert_string_equal(str, "bolaguda");
free(str);
- str = sb_strdup(NULL);
+ str = bc_strdup(NULL);
assert_null(str);
}
@@ -117,10 +117,10 @@ test_strndup(void **state)
static void
test_strdup_printf(void **state)
{
- char *str = sb_strdup_printf("bola");
+ char *str = bc_strdup_printf("bola");
assert_string_equal(str, "bola");
free(str);
- str = sb_strdup_printf("bola, %s", "guda");
+ str = bc_strdup_printf("bola, %s", "guda");
assert_string_equal(str, "bola, guda");
free(str);
}
@@ -129,141 +129,141 @@ test_strdup_printf(void **state)
static void
test_str_starts_with(void **state)
{
- assert_true(sb_str_starts_with("bolaguda", "bola"));
- assert_true(sb_str_starts_with("bola", "bola"));
- assert_false(sb_str_starts_with("gudabola", "bola"));
- assert_false(sb_str_starts_with("guda", "bola"));
- assert_false(sb_str_starts_with("bola", "bolaguda"));
+ assert_true(bc_str_starts_with("bolaguda", "bola"));
+ assert_true(bc_str_starts_with("bola", "bola"));
+ assert_false(bc_str_starts_with("gudabola", "bola"));
+ assert_false(bc_str_starts_with("guda", "bola"));
+ assert_false(bc_str_starts_with("bola", "bolaguda"));
}
static void
test_str_ends_with(void **state)
{
- assert_true(sb_str_ends_with("bolaguda", "guda"));
- assert_true(sb_str_ends_with("bola", "bola"));
- assert_false(sb_str_ends_with("gudabola", "guda"));
- assert_false(sb_str_ends_with("guda", "bola"));
- assert_false(sb_str_ends_with("bola", "gudabola"));
+ assert_true(bc_str_ends_with("bolaguda", "guda"));
+ assert_true(bc_str_ends_with("bola", "bola"));
+ assert_false(bc_str_ends_with("gudabola", "guda"));
+ assert_false(bc_str_ends_with("guda", "bola"));
+ assert_false(bc_str_ends_with("bola", "gudabola"));
}
static void
test_str_lstrip(void **state)
{
- char *str = sb_strdup(" \tbola\n \t");
- assert_string_equal(sb_str_lstrip(str), "bola\n \t");
+ char *str = bc_strdup(" \tbola\n \t");
+ assert_string_equal(bc_str_lstrip(str), "bola\n \t");
free(str);
- str = sb_strdup("guda");
- assert_string_equal(sb_str_lstrip(str), "guda");
+ str = bc_strdup("guda");
+ assert_string_equal(bc_str_lstrip(str), "guda");
free(str);
- str = sb_strdup("\n");
- assert_string_equal(sb_str_lstrip(str), "");
+ str = bc_strdup("\n");
+ assert_string_equal(bc_str_lstrip(str), "");
free(str);
- str = sb_strdup("\t \n");
- assert_string_equal(sb_str_lstrip(str), "");
+ str = bc_strdup("\t \n");
+ assert_string_equal(bc_str_lstrip(str), "");
free(str);
- str = sb_strdup("");
- assert_string_equal(sb_str_lstrip(str), "");
+ str = bc_strdup("");
+ assert_string_equal(bc_str_lstrip(str), "");
free(str);
- assert_null(sb_str_lstrip(NULL));
+ assert_null(bc_str_lstrip(NULL));
}
static void
test_str_rstrip(void **state)
{
- char *str = sb_strdup(" \tbola\n \t");
- assert_string_equal(sb_str_rstrip(str), " \tbola");
+ char *str = bc_strdup(" \tbola\n \t");
+ assert_string_equal(bc_str_rstrip(str), " \tbola");
free(str);
- str = sb_strdup("guda");
- assert_string_equal(sb_str_rstrip(str), "guda");
+ str = bc_strdup("guda");
+ assert_string_equal(bc_str_rstrip(str), "guda");
free(str);
- str = sb_strdup("\n");
- assert_string_equal(sb_str_rstrip(str), "");
+ str = bc_strdup("\n");
+ assert_string_equal(bc_str_rstrip(str), "");
free(str);
- str = sb_strdup("\t \n");
- assert_string_equal(sb_str_rstrip(str), "");
+ str = bc_strdup("\t \n");
+ assert_string_equal(bc_str_rstrip(str), "");
free(str);
- str = sb_strdup("");
- assert_string_equal(sb_str_rstrip(str), "");
+ str = bc_strdup("");
+ assert_string_equal(bc_str_rstrip(str), "");
free(str);
- assert_null(sb_str_rstrip(NULL));
+ assert_null(bc_str_rstrip(NULL));
}
static void
test_str_strip(void **state)
{
- char *str = sb_strdup(" \tbola\n \t");
- assert_string_equal(sb_str_strip(str), "bola");
+ char *str = bc_strdup(" \tbola\n \t");
+ assert_string_equal(bc_str_strip(str), "bola");
free(str);
- str = sb_strdup("guda");
- assert_string_equal(sb_str_strip(str), "guda");
+ str = bc_strdup("guda");
+ assert_string_equal(bc_str_strip(str), "guda");
free(str);
- str = sb_strdup("\n");
- assert_string_equal(sb_str_strip(str), "");
+ str = bc_strdup("\n");
+ assert_string_equal(bc_str_strip(str), "");
free(str);
- str = sb_strdup("\t \n");
- assert_string_equal(sb_str_strip(str), "");
+ str = bc_strdup("\t \n");
+ assert_string_equal(bc_str_strip(str), "");
free(str);
- str = sb_strdup("");
- assert_string_equal(sb_str_strip(str), "");
+ str = bc_strdup("");
+ assert_string_equal(bc_str_strip(str), "");
free(str);
- assert_null(sb_str_strip(NULL));
+ assert_null(bc_str_strip(NULL));
}
static void
test_str_split(void **state)
{
- char **strv = sb_str_split("bola:guda:chunda", ':', 0);
+ char **strv = bc_str_split("bola:guda:chunda", ':', 0);
assert_string_equal(strv[0], "bola");
assert_string_equal(strv[1], "guda");
assert_string_equal(strv[2], "chunda");
assert_null(strv[3]);
- sb_strv_free(strv);
- strv = sb_str_split("bola:guda:chunda", ':', 2);
+ bc_strv_free(strv);
+ strv = bc_str_split("bola:guda:chunda", ':', 2);
assert_string_equal(strv[0], "bola");
assert_string_equal(strv[1], "guda:chunda");
assert_null(strv[2]);
- sb_strv_free(strv);
- strv = sb_str_split("bola:guda:chunda", ':', 1);
+ bc_strv_free(strv);
+ strv = bc_str_split("bola:guda:chunda", ':', 1);
assert_string_equal(strv[0], "bola:guda:chunda");
assert_null(strv[1]);
- sb_strv_free(strv);
- strv = sb_str_split("", ':', 1);
+ bc_strv_free(strv);
+ strv = bc_str_split("", ':', 1);
assert_null(strv[0]);
- sb_strv_free(strv);
- assert_null(sb_str_split(NULL, ':', 0));
+ bc_strv_free(strv);
+ assert_null(bc_str_split(NULL, ':', 0));
}
static void
test_str_replace(void **state)
{
- char *str = sb_str_replace("bolao", 'o', "zaz");
+ char *str = bc_str_replace("bolao", 'o', "zaz");
assert_string_equal(str, "bzazlazaz");
free(str);
- str = sb_str_replace("bolao", 'b', "zaz");
+ str = bc_str_replace("bolao", 'b', "zaz");
assert_string_equal(str, "zazolao");
free(str);
- str = sb_str_replace("bolao", 'b', NULL);
+ str = bc_str_replace("bolao", 'b', NULL);
assert_string_equal(str, "bolao");
free(str);
- assert_null(sb_str_replace(NULL, 'b', "zaz"));
+ assert_null(bc_str_replace(NULL, 'b', "zaz"));
}
static void
test_str_find(void **state)
{
- assert_null(sb_str_find(NULL, 'c'));
- assert_string_equal(sb_str_find("bola", 'l'), "la");
- assert_string_equal(sb_str_find("bo\\lalala", 'l'), "lala");
- assert_string_equal(sb_str_find("bola", '\0'), "");
- assert_null(sb_str_find("bola", 'g'));
- assert_null(sb_str_find("bo\\la", 'l'));
+ assert_null(bc_str_find(NULL, 'c'));
+ assert_string_equal(bc_str_find("bola", 'l'), "la");
+ assert_string_equal(bc_str_find("bo\\lalala", 'l'), "lala");
+ assert_string_equal(bc_str_find("bola", '\0'), "");
+ assert_null(bc_str_find("bola", 'g'));
+ assert_null(bc_str_find("bo\\la", 'l'));
}
@@ -271,16 +271,16 @@ static void
test_strv_join(void **state)
{
char *pieces[] = {"guda","bola", "chunda", NULL};
- char *str = sb_strv_join(pieces, ":");
+ char *str = bc_strv_join(pieces, ":");
assert_string_equal(str, "guda:bola:chunda");
free(str);
char *pieces2[] = {NULL};
- str = sb_strv_join(pieces2, ":");
+ str = bc_strv_join(pieces2, ":");
assert_string_equal(str, "");
free(str);
- assert_null(sb_strv_join(pieces, NULL));
- assert_null(sb_strv_join(NULL, ":"));
- assert_null(sb_strv_join(NULL, NULL));
+ assert_null(bc_strv_join(pieces, NULL));
+ assert_null(bc_strv_join(NULL, ":"));
+ assert_null(bc_strv_join(NULL, NULL));
}
@@ -288,88 +288,88 @@ static void
test_strv_length(void **state)
{
char *pieces[] = {"guda","bola", "chunda", NULL};
- assert_int_equal(sb_strv_length(pieces), 3);
+ assert_int_equal(bc_strv_length(pieces), 3);
char *pieces2[] = {NULL};
- assert_int_equal(sb_strv_length(pieces2), 0);
- assert_int_equal(sb_strv_length(NULL), 0);
+ assert_int_equal(bc_strv_length(pieces2), 0);
+ assert_int_equal(bc_strv_length(NULL), 0);
}
static void
test_string_new(void **state)
{
- sb_string_t *str = sb_string_new();
+ bc_string_t *str = bc_string_new();
assert_non_null(str);
assert_string_equal(str->str, "");
assert_int_equal(str->len, 0);
assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE);
- assert_null(sb_string_free(str, true));
+ assert_null(bc_string_free(str, true));
}
static void
test_string_free(void **state)
{
- sb_string_t *str = sb_string_new();
+ bc_string_t *str = bc_string_new();
free(str->str);
- str->str = sb_strdup("bola");
+ str->str = bc_strdup("bola");
str->len = 4;
str->allocated_len = SB_STRING_CHUNK_SIZE;
- char *tmp = sb_string_free(str, false);
+ char *tmp = bc_string_free(str, false);
assert_string_equal(tmp, "bola");
free(tmp);
- assert_null(sb_string_free(NULL, false));
+ assert_null(bc_string_free(NULL, false));
}
static void
test_string_dup(void **state)
{
- sb_string_t *str = sb_string_new();
+ bc_string_t *str = bc_string_new();
free(str->str);
- str->str = sb_strdup("bola");
+ str->str = bc_strdup("bola");
str->len = 4;
str->allocated_len = SB_STRING_CHUNK_SIZE;
- sb_string_t *new = sb_string_dup(str);
+ bc_string_t *new = bc_string_dup(str);
assert_non_null(new);
assert_string_equal(new->str, "bola");
assert_int_equal(new->len, 4);
assert_int_equal(new->allocated_len, SB_STRING_CHUNK_SIZE);
- assert_null(sb_string_free(new, true));
- assert_null(sb_string_free(str, true));
- assert_null(sb_string_dup(NULL));
+ assert_null(bc_string_free(new, true));
+ assert_null(bc_string_free(str, true));
+ assert_null(bc_string_dup(NULL));
}
static void
test_string_append_len(void **state)
{
- sb_string_t *str = sb_string_new();
- str = sb_string_append_len(str, "guda", 4);
+ bc_string_t *str = bc_string_new();
+ str = bc_string_append_len(str, "guda", 4);
assert_non_null(str);
assert_string_equal(str->str, "guda");
assert_int_equal(str->len, 4);
assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE);
- assert_null(sb_string_free(str, true));
- str = sb_string_new();
- str = sb_string_append_len(str, "guda", 4);
- str = sb_string_append_len(str, "bola", 4);
+ assert_null(bc_string_free(str, true));
+ str = bc_string_new();
+ str = bc_string_append_len(str, "guda", 4);
+ str = bc_string_append_len(str, "bola", 4);
assert_non_null(str);
assert_string_equal(str->str, "gudabola");
assert_int_equal(str->len, 8);
assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE);
- assert_null(sb_string_free(str, true));
- str = sb_string_new();
- str = sb_string_append_len(str, "guda", 3);
- str = sb_string_append_len(str, "bola", 4);
+ assert_null(bc_string_free(str, true));
+ str = bc_string_new();
+ str = bc_string_append_len(str, "guda", 3);
+ str = bc_string_append_len(str, "bola", 4);
assert_non_null(str);
assert_string_equal(str->str, "gudbola");
assert_int_equal(str->len, 7);
assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE);
- assert_null(sb_string_free(str, true));
- str = sb_string_new();
- str = sb_string_append_len(str, "guda", 4);
- str = sb_string_append_len(str,
+ assert_null(bc_string_free(str, true));
+ str = bc_string_new();
+ str = bc_string_append_len(str, "guda", 4);
+ str = bc_string_append_len(str,
"cwlwmwxxmvjnwtidmjehzdeexbxjnjowruxjrqpgpfhmvwgqeacdjissntmbtsjidzkcw"
"nnqhxhneolbwqlctcxmrsutolrjikpavxombpfpjyaqltgvzrjidotalcuwrwxtaxjiwa"
"xfhfyzymtffusoqywaruxpybwggukltspqqmghzpqstvcvlqbkhquihzndnrvkaqvevaz"
@@ -379,8 +379,8 @@ test_string_append_len(void **state)
"dxntikgoqlidfnmdhxzevqzlzubvyleeksdirmmttqthhkvfjggznpmarcamacpvwsrnr"
"ftzfeyasjpxoevyptpdnqokswiondusnuymqwaryrmdgscbnuilxtypuynckancsfnwtg"
"okxhegoifakimxbbafkeannglvsxprqzfekdinssqymtfexf", 600);
- str = sb_string_append_len(str, NULL, 0);
- str = sb_string_append_len(str,
+ str = bc_string_append_len(str, NULL, 0);
+ str = bc_string_append_len(str,
"cwlwmwxxmvjnwtidmjehzdeexbxjnjowruxjrqpgpfhmvwgqeacdjissntmbtsjidzkcw"
"nnqhxhneolbwqlctcxmrsutolrjikpavxombpfpjyaqltgvzrjidotalcuwrwxtaxjiwa"
"xfhfyzymtffusoqywaruxpybwggukltspqqmghzpqstvcvlqbkhquihzndnrvkaqvevaz"
@@ -412,39 +412,39 @@ test_string_append_len(void **state)
"fkeannglvsxprqzfekdinssqymtfexf");
assert_int_equal(str->len, 1204);
assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE * 10);
- assert_null(sb_string_free(str, true));
- str = sb_string_new();
- str = sb_string_append_len(str, NULL, 0);
+ assert_null(bc_string_free(str, true));
+ str = bc_string_new();
+ str = bc_string_append_len(str, NULL, 0);
assert_non_null(str);
assert_string_equal(str->str, "");
assert_int_equal(str->len, 0);
assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE);
- assert_null(sb_string_free(str, true));
- assert_null(sb_string_append_len(NULL, "foo", 3));
+ assert_null(bc_string_free(str, true));
+ assert_null(bc_string_append_len(NULL, "foo", 3));
}
static void
test_string_append(void **state)
{
- sb_string_t *str = sb_string_new();
- str = sb_string_append(str, "guda");
+ bc_string_t *str = bc_string_new();
+ str = bc_string_append(str, "guda");
assert_non_null(str);
assert_string_equal(str->str, "guda");
assert_int_equal(str->len, 4);
assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE);
- assert_null(sb_string_free(str, true));
- str = sb_string_new();
- str = sb_string_append(str, "guda");
- str = sb_string_append(str, "bola");
+ assert_null(bc_string_free(str, true));
+ str = bc_string_new();
+ str = bc_string_append(str, "guda");
+ str = bc_string_append(str, "bola");
assert_non_null(str);
assert_string_equal(str->str, "gudabola");
assert_int_equal(str->len, 8);
assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE);
- assert_null(sb_string_free(str, true));
- str = sb_string_new();
- str = sb_string_append(str, "guda");
- str = sb_string_append(str,
+ assert_null(bc_string_free(str, true));
+ str = bc_string_new();
+ str = bc_string_append(str, "guda");
+ str = bc_string_append(str,
"cwlwmwxxmvjnwtidmjehzdeexbxjnjowruxjrqpgpfhmvwgqeacdjissntmbtsjidzkcw"
"nnqhxhneolbwqlctcxmrsutolrjikpavxombpfpjyaqltgvzrjidotalcuwrwxtaxjiwa"
"xfhfyzymtffusoqywaruxpybwggukltspqqmghzpqstvcvlqbkhquihzndnrvkaqvevaz"
@@ -454,8 +454,8 @@ test_string_append(void **state)
"dxntikgoqlidfnmdhxzevqzlzubvyleeksdirmmttqthhkvfjggznpmarcamacpvwsrnr"
"ftzfeyasjpxoevyptpdnqokswiondusnuymqwaryrmdgscbnuilxtypuynckancsfnwtg"
"okxhegoifakimxbbafkeannglvsxprqzfekdinssqymtfexf");
- str = sb_string_append(str, NULL);
- str = sb_string_append(str,
+ str = bc_string_append(str, NULL);
+ str = bc_string_append(str,
"cwlwmwxxmvjnwtidmjehzdeexbxjnjowruxjrqpgpfhmvwgqeacdjissntmbtsjidzkcw"
"nnqhxhneolbwqlctcxmrsutolrjikpavxombpfpjyaqltgvzrjidotalcuwrwxtaxjiwa"
"xfhfyzymtffusoqywaruxpybwggukltspqqmghzpqstvcvlqbkhquihzndnrvkaqvevaz"
@@ -487,26 +487,26 @@ test_string_append(void **state)
"fkeannglvsxprqzfekdinssqymtfexf");
assert_int_equal(str->len, 1204);
assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE * 10);
- assert_null(sb_string_free(str, true));
- str = sb_string_new();
- str = sb_string_append(str, NULL);
+ assert_null(bc_string_free(str, true));
+ str = bc_string_new();
+ str = bc_string_append(str, NULL);
assert_non_null(str);
assert_string_equal(str->str, "");
assert_int_equal(str->len, 0);
assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE);
- assert_null(sb_string_free(str, true));
- assert_null(sb_string_append(NULL, "asd"));
- assert_null(sb_string_append(NULL, NULL));
+ assert_null(bc_string_free(str, true));
+ assert_null(bc_string_append(NULL, "asd"));
+ assert_null(bc_string_append(NULL, NULL));
}
static void
test_string_append_c(void **state)
{
- sb_string_t *str = sb_string_new();
- str = sb_string_append_len(str, "guda", 4);
+ bc_string_t *str = bc_string_new();
+ str = bc_string_append_len(str, "guda", 4);
for (int i = 0; i < 600; i++)
- str = sb_string_append_c(str, 'c');
+ str = bc_string_append_c(str, 'c');
assert_non_null(str);
assert_string_equal(str->str,
"gudaccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
@@ -520,61 +520,61 @@ test_string_append_c(void **state)
"cccccccccccccccccccccccccccccccccccccccccccccccccccc");
assert_int_equal(str->len, 604);
assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE * 5);
- assert_null(sb_string_free(str, true));
- assert_null(sb_string_append_c(NULL, 0));
+ assert_null(bc_string_free(str, true));
+ assert_null(bc_string_append_c(NULL, 0));
}
static void
test_string_append_printf(void **state)
{
- sb_string_t *str = sb_string_new();
- str = sb_string_append_printf(str, "guda: %s %d", "bola", 1);
+ bc_string_t *str = bc_string_new();
+ str = bc_string_append_printf(str, "guda: %s %d", "bola", 1);
assert_non_null(str);
assert_string_equal(str->str, "guda: bola 1");
assert_int_equal(str->len, 12);
assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE);
- assert_null(sb_string_free(str, true));
- assert_null(sb_string_append_printf(NULL, "asd"));
+ assert_null(bc_string_free(str, true));
+ assert_null(bc_string_append_printf(NULL, "asd"));
}
static void
test_string_append_escaped(void **state)
{
- sb_string_t *str = sb_string_new();
- str = sb_string_append_escaped(str, NULL);
+ bc_string_t *str = bc_string_new();
+ str = bc_string_append_escaped(str, NULL);
assert_non_null(str);
assert_string_equal(str->str, "");
assert_int_equal(str->len, 0);
assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE);
- str = sb_string_append_escaped(str, "foo \\a bar \\\\ lol");
+ str = bc_string_append_escaped(str, "foo \\a bar \\\\ lol");
assert_non_null(str);
assert_string_equal(str->str, "foo a bar \\ lol");
assert_int_equal(str->len, 15);
assert_int_equal(str->allocated_len, SB_STRING_CHUNK_SIZE);
- assert_null(sb_string_free(str, true));
- assert_null(sb_string_append_escaped(NULL, "asd"));
+ assert_null(bc_string_free(str, true));
+ assert_null(bc_string_append_escaped(NULL, "asd"));
}
static void
test_trie_new(void **state)
{
- sb_trie_t *trie = sb_trie_new(free);
+ bc_trie_t *trie = bc_trie_new(free);
assert_non_null(trie);
assert_null(trie->root);
assert_true(trie->free_func == free);
- sb_trie_free(trie);
+ bc_trie_free(trie);
}
static void
test_trie_insert(void **state)
{
- sb_trie_t *trie = sb_trie_new(free);
+ bc_trie_t *trie = bc_trie_new(free);
- sb_trie_insert(trie, "bola", sb_strdup("guda"));
+ bc_trie_insert(trie, "bola", bc_strdup("guda"));
assert_true(trie->root->key == 'b');
assert_null(trie->root->data);
assert_true(trie->root->child->key == 'o');
@@ -587,7 +587,7 @@ test_trie_insert(void **state)
assert_string_equal(trie->root->child->child->child->child->data, "guda");
- sb_trie_insert(trie, "chu", sb_strdup("nda"));
+ bc_trie_insert(trie, "chu", bc_strdup("nda"));
assert_true(trie->root->key == 'b');
assert_null(trie->root->data);
assert_true(trie->root->child->key == 'o');
@@ -609,7 +609,7 @@ test_trie_insert(void **state)
assert_string_equal(trie->root->next->child->child->child->data, "nda");
- sb_trie_insert(trie, "bote", sb_strdup("aba"));
+ bc_trie_insert(trie, "bote", bc_strdup("aba"));
assert_true(trie->root->key == 'b');
assert_null(trie->root->data);
assert_true(trie->root->child->key == 'o');
@@ -638,7 +638,7 @@ test_trie_insert(void **state)
assert_string_equal(trie->root->child->child->next->child->child->data, "aba");
- sb_trie_insert(trie, "bo", sb_strdup("haha"));
+ bc_trie_insert(trie, "bo", bc_strdup("haha"));
assert_true(trie->root->key == 'b');
assert_null(trie->root->data);
assert_true(trie->root->child->key == 'o');
@@ -669,12 +669,12 @@ test_trie_insert(void **state)
assert_true(trie->root->child->child->next->next->key == '\0');
assert_string_equal(trie->root->child->child->next->next->data, "haha");
- sb_trie_free(trie);
+ bc_trie_free(trie);
- trie = sb_trie_new(free);
+ trie = bc_trie_new(free);
- sb_trie_insert(trie, "chu", sb_strdup("nda"));
+ bc_trie_insert(trie, "chu", bc_strdup("nda"));
assert_true(trie->root->key == 'c');
assert_null(trie->root->data);
assert_true(trie->root->child->key == 'h');
@@ -685,7 +685,7 @@ test_trie_insert(void **state)
assert_string_equal(trie->root->child->child->child->data, "nda");
- sb_trie_insert(trie, "bola", sb_strdup("guda"));
+ bc_trie_insert(trie, "bola", bc_strdup("guda"));
assert_true(trie->root->key == 'c');
assert_null(trie->root->data);
assert_true(trie->root->child->key == 'h');
@@ -707,7 +707,7 @@ test_trie_insert(void **state)
assert_string_equal(trie->root->next->child->child->child->child->data, "guda");
- sb_trie_insert(trie, "bote", sb_strdup("aba"));
+ bc_trie_insert(trie, "bote", bc_strdup("aba"));
assert_true(trie->root->key == 'c');
assert_null(trie->root->data);
assert_true(trie->root->child->key == 'h');
@@ -736,7 +736,7 @@ test_trie_insert(void **state)
assert_string_equal(trie->root->next->child->child->next->child->child->data, "aba");
- sb_trie_insert(trie, "bo", sb_strdup("haha"));
+ bc_trie_insert(trie, "bo", bc_strdup("haha"));
assert_true(trie->root->key == 'c');
assert_null(trie->root->data);
assert_true(trie->root->child->key == 'h');
@@ -767,16 +767,16 @@ test_trie_insert(void **state)
assert_true(trie->root->next->child->child->next->next->key == '\0');
assert_string_equal(trie->root->next->child->child->next->next->data, "haha");
- sb_trie_free(trie);
+ bc_trie_free(trie);
}
static void
test_trie_insert_duplicated(void **state)
{
- sb_trie_t *trie = sb_trie_new(free);
+ bc_trie_t *trie = bc_trie_new(free);
- sb_trie_insert(trie, "bola", sb_strdup("guda"));
+ bc_trie_insert(trie, "bola", bc_strdup("guda"));
assert_true(trie->root->key == 'b');
assert_null(trie->root->data);
assert_true(trie->root->child->key == 'o');
@@ -788,7 +788,7 @@ test_trie_insert_duplicated(void **state)
assert_true(trie->root->child->child->child->child->key == '\0');
assert_string_equal(trie->root->child->child->child->child->data, "guda");
- sb_trie_insert(trie, "bola", sb_strdup("asdf"));
+ bc_trie_insert(trie, "bola", bc_strdup("asdf"));
assert_true(trie->root->key == 'b');
assert_null(trie->root->data);
assert_true(trie->root->child->key == 'o');
@@ -800,10 +800,10 @@ test_trie_insert_duplicated(void **state)
assert_true(trie->root->child->child->child->child->key == '\0');
assert_string_equal(trie->root->child->child->child->child->data, "asdf");
- sb_trie_free(trie);
+ bc_trie_free(trie);
trie = NULL;
- sb_trie_insert(trie, "bola", NULL);
+ bc_trie_insert(trie, "bola", NULL);
assert_null(trie);
}
@@ -811,19 +811,19 @@ test_trie_insert_duplicated(void **state)
static void
test_trie_keep_data(void **state)
{
- sb_trie_t *trie = sb_trie_new(NULL);
+ bc_trie_t *trie = bc_trie_new(NULL);
char *t1 = "guda";
char *t2 = "nda";
char *t3 = "aba";
char *t4 = "haha";
- sb_trie_insert(trie, "bola", t1);
- sb_trie_insert(trie, "chu", t2);
- sb_trie_insert(trie, "bote", t3);
- sb_trie_insert(trie, "bo", t4);
+ bc_trie_insert(trie, "bola", t1);
+ bc_trie_insert(trie, "chu", t2);
+ bc_trie_insert(trie, "bote", t3);
+ bc_trie_insert(trie, "bo", t4);
- sb_trie_free(trie);
+ bc_trie_free(trie);
assert_string_equal(t1, "guda");
assert_string_equal(t2, "nda");
@@ -835,74 +835,74 @@ test_trie_keep_data(void **state)
static void
test_trie_lookup(void **state)
{
- sb_trie_t *trie = sb_trie_new(free);
+ bc_trie_t *trie = bc_trie_new(free);
- sb_trie_insert(trie, "bola", sb_strdup("guda"));
- sb_trie_insert(trie, "chu", sb_strdup("nda"));
- sb_trie_insert(trie, "bote", sb_strdup("aba"));
- sb_trie_insert(trie, "bo", sb_strdup("haha"));
+ bc_trie_insert(trie, "bola", bc_strdup("guda"));
+ bc_trie_insert(trie, "chu", bc_strdup("nda"));
+ bc_trie_insert(trie, "bote", bc_strdup("aba"));
+ bc_trie_insert(trie, "bo", bc_strdup("haha"));
- assert_string_equal(sb_trie_lookup(trie, "bola"), "guda");
- assert_string_equal(sb_trie_lookup(trie, "chu"), "nda");
- assert_string_equal(sb_trie_lookup(trie, "bote"), "aba");
- assert_string_equal(sb_trie_lookup(trie, "bo"), "haha");
+ assert_string_equal(bc_trie_lookup(trie, "bola"), "guda");
+ assert_string_equal(bc_trie_lookup(trie, "chu"), "nda");
+ assert_string_equal(bc_trie_lookup(trie, "bote"), "aba");
+ assert_string_equal(bc_trie_lookup(trie, "bo"), "haha");
- assert_null(sb_trie_lookup(trie, "arcoiro"));
+ assert_null(bc_trie_lookup(trie, "arcoiro"));
- sb_trie_free(trie);
+ bc_trie_free(trie);
- trie = sb_trie_new(free);
+ trie = bc_trie_new(free);
- sb_trie_insert(trie, "chu", sb_strdup("nda"));
- sb_trie_insert(trie, "bola", sb_strdup("guda"));
- sb_trie_insert(trie, "bote", sb_strdup("aba"));
- sb_trie_insert(trie, "bo", sb_strdup("haha"));
- sb_trie_insert(trie, "copa", sb_strdup("bu"));
- sb_trie_insert(trie, "b", sb_strdup("c"));
- sb_trie_insert(trie, "test", sb_strdup("asd"));
+ bc_trie_insert(trie, "chu", bc_strdup("nda"));
+ bc_trie_insert(trie, "bola", bc_strdup("guda"));
+ bc_trie_insert(trie, "bote", bc_strdup("aba"));
+ bc_trie_insert(trie, "bo", bc_strdup("haha"));
+ bc_trie_insert(trie, "copa", bc_strdup("bu"));
+ bc_trie_insert(trie, "b", bc_strdup("c"));
+ bc_trie_insert(trie, "test", bc_strdup("asd"));
- assert_string_equal(sb_trie_lookup(trie, "bola"), "guda");
- assert_string_equal(sb_trie_lookup(trie, "chu"), "nda");
- assert_string_equal(sb_trie_lookup(trie, "bote"), "aba");
- assert_string_equal(sb_trie_lookup(trie, "bo"), "haha");
+ assert_string_equal(bc_trie_lookup(trie, "bola"), "guda");
+ assert_string_equal(bc_trie_lookup(trie, "chu"), "nda");
+ assert_string_equal(bc_trie_lookup(trie, "bote"), "aba");
+ assert_string_equal(bc_trie_lookup(trie, "bo"), "haha");
- assert_null(sb_trie_lookup(trie, "arcoiro"));
+ assert_null(bc_trie_lookup(trie, "arcoiro"));
- sb_trie_free(trie);
+ bc_trie_free(trie);
- assert_null(sb_trie_lookup(NULL, "bola"));
+ assert_null(bc_trie_lookup(NULL, "bola"));
}
static void
test_trie_size(void **state)
{
- sb_trie_t *trie = sb_trie_new(free);
+ bc_trie_t *trie = bc_trie_new(free);
- sb_trie_insert(trie, "bola", sb_strdup("guda"));
- sb_trie_insert(trie, "chu", sb_strdup("nda"));
- sb_trie_insert(trie, "bote", sb_strdup("aba"));
- sb_trie_insert(trie, "bo", sb_strdup("haha"));
+ bc_trie_insert(trie, "bola", bc_strdup("guda"));
+ bc_trie_insert(trie, "chu", bc_strdup("nda"));
+ bc_trie_insert(trie, "bote", bc_strdup("aba"));
+ bc_trie_insert(trie, "bo", bc_strdup("haha"));
- assert_int_equal(sb_trie_size(trie), 4);
- assert_int_equal(sb_trie_size(NULL), 0);
+ assert_int_equal(bc_trie_size(trie), 4);
+ assert_int_equal(bc_trie_size(NULL), 0);
- sb_trie_free(trie);
+ bc_trie_free(trie);
- trie = sb_trie_new(free);
+ trie = bc_trie_new(free);
- sb_trie_insert(trie, "chu", sb_strdup("nda"));
- sb_trie_insert(trie, "bola", sb_strdup("guda"));
- sb_trie_insert(trie, "bote", sb_strdup("aba"));
- sb_trie_insert(trie, "bo", sb_strdup("haha"));
- sb_trie_insert(trie, "copa", sb_strdup("bu"));
- sb_trie_insert(trie, "b", sb_strdup("c"));
- sb_trie_insert(trie, "test", sb_strdup("asd"));
+ bc_trie_insert(trie, "chu", bc_strdup("nda"));
+ bc_trie_insert(trie, "bola", bc_strdup("guda"));
+ bc_trie_insert(trie, "bote", bc_strdup("aba"));
+ bc_trie_insert(trie, "bo", bc_strdup("haha"));
+ bc_trie_insert(trie, "copa", bc_strdup("bu"));
+ bc_trie_insert(trie, "b", bc_strdup("c"));
+ bc_trie_insert(trie, "test", bc_strdup("asd"));
- assert_int_equal(sb_trie_size(trie), 7);
- assert_int_equal(sb_trie_size(NULL), 0);
+ assert_int_equal(bc_trie_size(trie), 7);
+ assert_int_equal(bc_trie_size(NULL), 0);
- sb_trie_free(trie);
+ bc_trie_free(trie);
}
@@ -922,24 +922,24 @@ mock_foreach(const char *key, void *data, void *user_data)
static void
test_trie_foreach(void **state)
{
- sb_trie_t *trie = sb_trie_new(free);
+ bc_trie_t *trie = bc_trie_new(free);
- sb_trie_insert(trie, "chu", sb_strdup("nda"));
- sb_trie_insert(trie, "bola", sb_strdup("guda"));
- sb_trie_insert(trie, "bote", sb_strdup("aba"));
- sb_trie_insert(trie, "bo", sb_strdup("haha"));
- sb_trie_insert(trie, "copa", sb_strdup("bu"));
- sb_trie_insert(trie, "b", sb_strdup("c"));
- sb_trie_insert(trie, "test", sb_strdup("asd"));
+ bc_trie_insert(trie, "chu", bc_strdup("nda"));
+ bc_trie_insert(trie, "bola", bc_strdup("guda"));
+ bc_trie_insert(trie, "bote", bc_strdup("aba"));
+ bc_trie_insert(trie, "bo", bc_strdup("haha"));
+ bc_trie_insert(trie, "copa", bc_strdup("bu"));
+ bc_trie_insert(trie, "b", bc_strdup("c"));
+ bc_trie_insert(trie, "test", bc_strdup("asd"));
counter = 0;
- sb_trie_foreach(trie, mock_foreach, "foo");
- sb_trie_foreach(NULL, mock_foreach, "foo");
- sb_trie_foreach(trie, NULL, "foo");
- sb_trie_foreach(NULL, NULL, "foo");
+ bc_trie_foreach(trie, mock_foreach, "foo");
+ bc_trie_foreach(NULL, mock_foreach, "foo");
+ bc_trie_foreach(trie, NULL, "foo");
+ bc_trie_foreach(NULL, NULL, "foo");
assert_int_equal(counter, 7);
- sb_trie_free(trie);
+ bc_trie_free(trie);
}