aboutsummaryrefslogtreecommitdiffstats
path: root/tests
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
parent6c5adce7b557c696cb6b5a5ebd4cd1e9380ac419 (diff)
downloadblogc-a319fe44f6d50d25f546e17ad9907eedd9a358a0.tar.gz
blogc-a319fe44f6d50d25f546e17ad9907eedd9a358a0.tar.bz2
blogc-a319fe44f6d50d25f546e17ad9907eedd9a358a0.zip
*: s/sb_/bc_/g
Diffstat (limited to 'tests')
-rw-r--r--tests/blogc/check_loader.c544
-rw-r--r--tests/blogc/check_renderer.c320
-rw-r--r--tests/blogc/check_source_parser.c166
-rw-r--r--tests/blogc/check_template_parser.c104
-rw-r--r--tests/common/check_utf8.c24
-rw-r--r--tests/common/check_utils.c498
6 files changed, 828 insertions, 828 deletions
diff --git a/tests/blogc/check_loader.c b/tests/blogc/check_loader.c
index 8d3d9d6..abe1f29 100644
--- a/tests/blogc/check_loader.c
+++ b/tests/blogc/check_loader.c
@@ -78,11 +78,11 @@ test_template_parse_from_file(void **state)
{
blogc_error_t *err = NULL;
will_return(__wrap_blogc_file_get_contents, "bola");
- will_return(__wrap_blogc_file_get_contents, sb_strdup("{{ BOLA }}\n"));
- sb_slist_t *l = blogc_template_parse_from_file("bola", &err);
+ will_return(__wrap_blogc_file_get_contents, bc_strdup("{{ BOLA }}\n"));
+ bc_slist_t *l = blogc_template_parse_from_file("bola", &err);
assert_null(err);
assert_non_null(l);
- assert_int_equal(sb_slist_length(l), 2);
+ assert_int_equal(bc_slist_length(l), 2);
blogc_template_free_stmts(l);
}
@@ -93,7 +93,7 @@ test_template_parse_from_file_null(void **state)
blogc_error_t *err = NULL;
will_return(__wrap_blogc_file_get_contents, "bola");
will_return(__wrap_blogc_file_get_contents, NULL);
- sb_slist_t *l = blogc_template_parse_from_file("bola", &err);
+ bc_slist_t *l = blogc_template_parse_from_file("bola", &err);
assert_null(err);
assert_null(l);
}
@@ -104,21 +104,21 @@ test_source_parse_from_file(void **state)
{
blogc_error_t *err = NULL;
will_return(__wrap_blogc_file_get_contents, "bola.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 123\n"
"--------\n"
"bola"));
- sb_trie_t *t = blogc_source_parse_from_file("bola.txt", &err);
+ bc_trie_t *t = blogc_source_parse_from_file("bola.txt", &err);
assert_null(err);
assert_non_null(t);
- assert_int_equal(sb_trie_size(t), 6);
- assert_string_equal(sb_trie_lookup(t, "ASD"), "123");
- assert_string_equal(sb_trie_lookup(t, "FILENAME"), "bola");
- assert_string_equal(sb_trie_lookup(t, "EXCERPT"), "<p>bola</p>\n");
- assert_string_equal(sb_trie_lookup(t, "CONTENT"), "<p>bola</p>\n");
- assert_string_equal(sb_trie_lookup(t, "RAW_CONTENT"), "bola");
- assert_string_equal(sb_trie_lookup(t, "DESCRIPTION"), "bola");
- sb_trie_free(t);
+ assert_int_equal(bc_trie_size(t), 6);
+ assert_string_equal(bc_trie_lookup(t, "ASD"), "123");
+ assert_string_equal(bc_trie_lookup(t, "FILENAME"), "bola");
+ assert_string_equal(bc_trie_lookup(t, "EXCERPT"), "<p>bola</p>\n");
+ assert_string_equal(bc_trie_lookup(t, "CONTENT"), "<p>bola</p>\n");
+ assert_string_equal(bc_trie_lookup(t, "RAW_CONTENT"), "bola");
+ assert_string_equal(bc_trie_lookup(t, "DESCRIPTION"), "bola");
+ bc_trie_free(t);
}
@@ -128,7 +128,7 @@ test_source_parse_from_file_null(void **state)
blogc_error_t *err = NULL;
will_return(__wrap_blogc_file_get_contents, "bola.txt");
will_return(__wrap_blogc_file_get_contents, NULL);
- sb_trie_t *t = blogc_source_parse_from_file("bola.txt", &err);
+ bc_trie_t *t = blogc_source_parse_from_file("bola.txt", &err);
assert_null(err);
assert_null(t);
}
@@ -138,41 +138,41 @@ static void
test_source_parse_from_files(void **state)
{
will_return(__wrap_blogc_file_get_contents, "bola1.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 123\n"
"DATE: 2001-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola2.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 456\n"
"DATE: 2002-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola3.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 789\n"
"DATE: 2003-02-03 04:05:06\n"
"--------\n"
"bola"));
blogc_error_t *err = NULL;
- sb_slist_t *s = NULL;
- s = sb_slist_append(s, sb_strdup("bola1.txt"));
- s = sb_slist_append(s, sb_strdup("bola2.txt"));
- s = sb_slist_append(s, sb_strdup("bola3.txt"));
- sb_trie_t *c = sb_trie_new(free);
- sb_slist_t *t = blogc_source_parse_from_files(c, s, &err);
+ bc_slist_t *s = NULL;
+ s = bc_slist_append(s, bc_strdup("bola1.txt"));
+ s = bc_slist_append(s, bc_strdup("bola2.txt"));
+ s = bc_slist_append(s, bc_strdup("bola3.txt"));
+ bc_trie_t *c = bc_trie_new(free);
+ bc_slist_t *t = blogc_source_parse_from_files(c, s, &err);
assert_null(err);
assert_non_null(t);
- assert_int_equal(sb_slist_length(t), 3); // it is enough, no need to look at the items
- assert_int_equal(sb_trie_size(c), 4);
- assert_string_equal(sb_trie_lookup(c, "FILENAME_FIRST"), "bola1");
- assert_string_equal(sb_trie_lookup(c, "FILENAME_LAST"), "bola3");
- assert_string_equal(sb_trie_lookup(c, "DATE_FIRST"), "2001-02-03 04:05:06");
- assert_string_equal(sb_trie_lookup(c, "DATE_LAST"), "2003-02-03 04:05:06");
- sb_trie_free(c);
- sb_slist_free_full(s, free);
- sb_slist_free_full(t, (sb_free_func_t) sb_trie_free);
+ assert_int_equal(bc_slist_length(t), 3); // it is enough, no need to look at the items
+ assert_int_equal(bc_trie_size(c), 4);
+ assert_string_equal(bc_trie_lookup(c, "FILENAME_FIRST"), "bola1");
+ assert_string_equal(bc_trie_lookup(c, "FILENAME_LAST"), "bola3");
+ assert_string_equal(bc_trie_lookup(c, "DATE_FIRST"), "2001-02-03 04:05:06");
+ assert_string_equal(bc_trie_lookup(c, "DATE_LAST"), "2003-02-03 04:05:06");
+ bc_trie_free(c);
+ bc_slist_free_full(s, free);
+ bc_slist_free_full(t, (bc_free_func_t) bc_trie_free);
}
@@ -180,45 +180,45 @@ static void
test_source_parse_from_files_filter_by_tag(void **state)
{
will_return(__wrap_blogc_file_get_contents, "bola1.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 123\n"
"DATE: 2001-02-03 04:05:06\n"
"TAGS: chunda\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola2.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 456\n"
"DATE: 2002-02-03 04:05:06\n"
"TAGS: bola, chunda\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola3.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 789\n"
"DATE: 2003-02-03 04:05:06\n"
"--------\n"
"bola"));
blogc_error_t *err = NULL;
- sb_slist_t *s = NULL;
- s = sb_slist_append(s, sb_strdup("bola1.txt"));
- s = sb_slist_append(s, sb_strdup("bola2.txt"));
- s = sb_slist_append(s, sb_strdup("bola3.txt"));
- sb_trie_t *c = sb_trie_new(free);
- sb_trie_insert(c, "FILTER_TAG", sb_strdup("chunda"));
- sb_slist_t *t = blogc_source_parse_from_files(c, s, &err);
+ bc_slist_t *s = NULL;
+ s = bc_slist_append(s, bc_strdup("bola1.txt"));
+ s = bc_slist_append(s, bc_strdup("bola2.txt"));
+ s = bc_slist_append(s, bc_strdup("bola3.txt"));
+ bc_trie_t *c = bc_trie_new(free);
+ bc_trie_insert(c, "FILTER_TAG", bc_strdup("chunda"));
+ bc_slist_t *t = blogc_source_parse_from_files(c, s, &err);
assert_null(err);
assert_non_null(t);
- assert_int_equal(sb_slist_length(t), 2); // it is enough, no need to look at the items
- assert_int_equal(sb_trie_size(c), 5);
- assert_string_equal(sb_trie_lookup(c, "FILENAME_FIRST"), "bola1");
- assert_string_equal(sb_trie_lookup(c, "FILENAME_LAST"), "bola2");
- assert_string_equal(sb_trie_lookup(c, "DATE_FIRST"), "2001-02-03 04:05:06");
- assert_string_equal(sb_trie_lookup(c, "DATE_LAST"), "2002-02-03 04:05:06");
- assert_string_equal(sb_trie_lookup(c, "FILTER_TAG"), "chunda");
- sb_trie_free(c);
- sb_slist_free_full(s, free);
- sb_slist_free_full(t, (sb_free_func_t) sb_trie_free);
+ assert_int_equal(bc_slist_length(t), 2); // it is enough, no need to look at the items
+ assert_int_equal(bc_trie_size(c), 5);
+ assert_string_equal(bc_trie_lookup(c, "FILENAME_FIRST"), "bola1");
+ assert_string_equal(bc_trie_lookup(c, "FILENAME_LAST"), "bola2");
+ assert_string_equal(bc_trie_lookup(c, "DATE_FIRST"), "2001-02-03 04:05:06");
+ assert_string_equal(bc_trie_lookup(c, "DATE_LAST"), "2002-02-03 04:05:06");
+ assert_string_equal(bc_trie_lookup(c, "FILTER_TAG"), "chunda");
+ bc_trie_free(c);
+ bc_slist_free_full(s, free);
+ bc_slist_free_full(t, (bc_free_func_t) bc_trie_free);
}
@@ -226,77 +226,77 @@ static void
test_source_parse_from_files_filter_by_page(void **state)
{
will_return(__wrap_blogc_file_get_contents, "bola1.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 123\n"
"DATE: 2001-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola2.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 456\n"
"DATE: 2002-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola3.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 789\n"
"DATE: 2003-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola4.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 7891\n"
"DATE: 2004-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola5.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 7892\n"
"DATE: 2005-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola6.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 7893\n"
"DATE: 2006-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola7.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 7894\n"
"DATE: 2007-02-03 04:05:06\n"
"--------\n"
"bola"));
blogc_error_t *err = NULL;
- sb_slist_t *s = NULL;
- s = sb_slist_append(s, sb_strdup("bola1.txt"));
- s = sb_slist_append(s, sb_strdup("bola2.txt"));
- s = sb_slist_append(s, sb_strdup("bola3.txt"));
- s = sb_slist_append(s, sb_strdup("bola4.txt"));
- s = sb_slist_append(s, sb_strdup("bola5.txt"));
- s = sb_slist_append(s, sb_strdup("bola6.txt"));
- s = sb_slist_append(s, sb_strdup("bola7.txt"));
- sb_trie_t *c = sb_trie_new(free);
- sb_trie_insert(c, "FILTER_PAGE", sb_strdup("1"));
- sb_trie_insert(c, "FILTER_PER_PAGE", sb_strdup("2"));
- sb_slist_t *t = blogc_source_parse_from_files(c, s, &err);
+ bc_slist_t *s = NULL;
+ s = bc_slist_append(s, bc_strdup("bola1.txt"));
+ s = bc_slist_append(s, bc_strdup("bola2.txt"));
+ s = bc_slist_append(s, bc_strdup("bola3.txt"));
+ s = bc_slist_append(s, bc_strdup("bola4.txt"));
+ s = bc_slist_append(s, bc_strdup("bola5.txt"));
+ s = bc_slist_append(s, bc_strdup("bola6.txt"));
+ s = bc_slist_append(s, bc_strdup("bola7.txt"));
+ bc_trie_t *c = bc_trie_new(free);
+ bc_trie_insert(c, "FILTER_PAGE", bc_strdup("1"));
+ bc_trie_insert(c, "FILTER_PER_PAGE", bc_strdup("2"));
+ bc_slist_t *t = blogc_source_parse_from_files(c, s, &err);
assert_null(err);
assert_non_null(t);
- assert_int_equal(sb_slist_length(t), 2); // it is enough, no need to look at the items
- assert_int_equal(sb_trie_size(c), 10);
- assert_string_equal(sb_trie_lookup(c, "FILENAME_FIRST"), "bola1");
- assert_string_equal(sb_trie_lookup(c, "FILENAME_LAST"), "bola2");
- assert_string_equal(sb_trie_lookup(c, "DATE_FIRST"), "2001-02-03 04:05:06");
- assert_string_equal(sb_trie_lookup(c, "DATE_LAST"), "2002-02-03 04:05:06");
- assert_string_equal(sb_trie_lookup(c, "FILTER_PAGE"), "1");
- assert_string_equal(sb_trie_lookup(c, "FILTER_PER_PAGE"), "2");
- assert_string_equal(sb_trie_lookup(c, "CURRENT_PAGE"), "1");
- assert_string_equal(sb_trie_lookup(c, "NEXT_PAGE"), "2");
- assert_string_equal(sb_trie_lookup(c, "FIRST_PAGE"), "1");
- assert_string_equal(sb_trie_lookup(c, "LAST_PAGE"), "4");
- sb_trie_free(c);
- sb_slist_free_full(s, free);
- sb_slist_free_full(t, (sb_free_func_t) sb_trie_free);
+ assert_int_equal(bc_slist_length(t), 2); // it is enough, no need to look at the items
+ assert_int_equal(bc_trie_size(c), 10);
+ assert_string_equal(bc_trie_lookup(c, "FILENAME_FIRST"), "bola1");
+ assert_string_equal(bc_trie_lookup(c, "FILENAME_LAST"), "bola2");
+ assert_string_equal(bc_trie_lookup(c, "DATE_FIRST"), "2001-02-03 04:05:06");
+ assert_string_equal(bc_trie_lookup(c, "DATE_LAST"), "2002-02-03 04:05:06");
+ assert_string_equal(bc_trie_lookup(c, "FILTER_PAGE"), "1");
+ assert_string_equal(bc_trie_lookup(c, "FILTER_PER_PAGE"), "2");
+ assert_string_equal(bc_trie_lookup(c, "CURRENT_PAGE"), "1");
+ assert_string_equal(bc_trie_lookup(c, "NEXT_PAGE"), "2");
+ assert_string_equal(bc_trie_lookup(c, "FIRST_PAGE"), "1");
+ assert_string_equal(bc_trie_lookup(c, "LAST_PAGE"), "4");
+ bc_trie_free(c);
+ bc_slist_free_full(s, free);
+ bc_slist_free_full(t, (bc_free_func_t) bc_trie_free);
}
@@ -304,78 +304,78 @@ static void
test_source_parse_from_files_filter_by_page2(void **state)
{
will_return(__wrap_blogc_file_get_contents, "bola1.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 123\n"
"DATE: 2001-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola2.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 456\n"
"DATE: 2002-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola3.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 789\n"
"DATE: 2003-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola4.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 7891\n"
"DATE: 2004-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola5.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 7892\n"
"DATE: 2005-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola6.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 7893\n"
"DATE: 2006-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola7.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 7894\n"
"DATE: 2007-02-03 04:05:06\n"
"--------\n"
"bola"));
blogc_error_t *err = NULL;
- sb_slist_t *s = NULL;
- s = sb_slist_append(s, sb_strdup("bola1.txt"));
- s = sb_slist_append(s, sb_strdup("bola2.txt"));
- s = sb_slist_append(s, sb_strdup("bola3.txt"));
- s = sb_slist_append(s, sb_strdup("bola4.txt"));
- s = sb_slist_append(s, sb_strdup("bola5.txt"));
- s = sb_slist_append(s, sb_strdup("bola6.txt"));
- s = sb_slist_append(s, sb_strdup("bola7.txt"));
- sb_trie_t *c = sb_trie_new(free);
- sb_trie_insert(c, "FILTER_PAGE", sb_strdup("3"));
- sb_trie_insert(c, "FILTER_PER_PAGE", sb_strdup("2"));
- sb_slist_t *t = blogc_source_parse_from_files(c, s, &err);
+ bc_slist_t *s = NULL;
+ s = bc_slist_append(s, bc_strdup("bola1.txt"));
+ s = bc_slist_append(s, bc_strdup("bola2.txt"));
+ s = bc_slist_append(s, bc_strdup("bola3.txt"));
+ s = bc_slist_append(s, bc_strdup("bola4.txt"));
+ s = bc_slist_append(s, bc_strdup("bola5.txt"));
+ s = bc_slist_append(s, bc_strdup("bola6.txt"));
+ s = bc_slist_append(s, bc_strdup("bola7.txt"));
+ bc_trie_t *c = bc_trie_new(free);
+ bc_trie_insert(c, "FILTER_PAGE", bc_strdup("3"));
+ bc_trie_insert(c, "FILTER_PER_PAGE", bc_strdup("2"));
+ bc_slist_t *t = blogc_source_parse_from_files(c, s, &err);
assert_null(err);
assert_non_null(t);
- assert_int_equal(sb_slist_length(t), 2); // it is enough, no need to look at the items
- assert_int_equal(sb_trie_size(c), 11);
- assert_string_equal(sb_trie_lookup(c, "FILENAME_FIRST"), "bola5");
- assert_string_equal(sb_trie_lookup(c, "FILENAME_LAST"), "bola6");
- assert_string_equal(sb_trie_lookup(c, "DATE_FIRST"), "2005-02-03 04:05:06");
- assert_string_equal(sb_trie_lookup(c, "DATE_LAST"), "2006-02-03 04:05:06");
- assert_string_equal(sb_trie_lookup(c, "FILTER_PAGE"), "3");
- assert_string_equal(sb_trie_lookup(c, "FILTER_PER_PAGE"), "2");
- assert_string_equal(sb_trie_lookup(c, "CURRENT_PAGE"), "3");
- assert_string_equal(sb_trie_lookup(c, "PREVIOUS_PAGE"), "2");
- assert_string_equal(sb_trie_lookup(c, "NEXT_PAGE"), "4");
- assert_string_equal(sb_trie_lookup(c, "FIRST_PAGE"), "1");
- assert_string_equal(sb_trie_lookup(c, "LAST_PAGE"), "4");
- sb_trie_free(c);
- sb_slist_free_full(s, free);
- sb_slist_free_full(t, (sb_free_func_t) sb_trie_free);
+ assert_int_equal(bc_slist_length(t), 2); // it is enough, no need to look at the items
+ assert_int_equal(bc_trie_size(c), 11);
+ assert_string_equal(bc_trie_lookup(c, "FILENAME_FIRST"), "bola5");
+ assert_string_equal(bc_trie_lookup(c, "FILENAME_LAST"), "bola6");
+ assert_string_equal(bc_trie_lookup(c, "DATE_FIRST"), "2005-02-03 04:05:06");
+ assert_string_equal(bc_trie_lookup(c, "DATE_LAST"), "2006-02-03 04:05:06");
+ assert_string_equal(bc_trie_lookup(c, "FILTER_PAGE"), "3");
+ assert_string_equal(bc_trie_lookup(c, "FILTER_PER_PAGE"), "2");
+ assert_string_equal(bc_trie_lookup(c, "CURRENT_PAGE"), "3");
+ assert_string_equal(bc_trie_lookup(c, "PREVIOUS_PAGE"), "2");
+ assert_string_equal(bc_trie_lookup(c, "NEXT_PAGE"), "4");
+ assert_string_equal(bc_trie_lookup(c, "FIRST_PAGE"), "1");
+ assert_string_equal(bc_trie_lookup(c, "LAST_PAGE"), "4");
+ bc_trie_free(c);
+ bc_slist_free_full(s, free);
+ bc_slist_free_full(t, (bc_free_func_t) bc_trie_free);
}
@@ -383,77 +383,77 @@ static void
test_source_parse_from_files_filter_by_page3(void **state)
{
will_return(__wrap_blogc_file_get_contents, "bola1.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 123\n"
"DATE: 2001-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola2.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 456\n"
"DATE: 2002-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola3.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 789\n"
"DATE: 2003-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola4.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 7891\n"
"DATE: 2004-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola5.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 7892\n"
"DATE: 2005-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola6.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 7893\n"
"DATE: 2006-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola7.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 7894\n"
"DATE: 2007-02-03 04:05:06\n"
"--------\n"
"bola"));
blogc_error_t *err = NULL;
- sb_slist_t *s = NULL;
- s = sb_slist_append(s, sb_strdup("bola1.txt"));
- s = sb_slist_append(s, sb_strdup("bola2.txt"));
- s = sb_slist_append(s, sb_strdup("bola3.txt"));
- s = sb_slist_append(s, sb_strdup("bola4.txt"));
- s = sb_slist_append(s, sb_strdup("bola5.txt"));
- s = sb_slist_append(s, sb_strdup("bola6.txt"));
- s = sb_slist_append(s, sb_strdup("bola7.txt"));
- sb_trie_t *c = sb_trie_new(free);
- sb_trie_insert(c, "FILTER_PAGE", sb_strdup("1"));
- sb_trie_insert(c, "FILTER_PER_PAGE", sb_strdup("2"));
- sb_slist_t *t = blogc_source_parse_from_files(c, s, &err);
+ bc_slist_t *s = NULL;
+ s = bc_slist_append(s, bc_strdup("bola1.txt"));
+ s = bc_slist_append(s, bc_strdup("bola2.txt"));
+ s = bc_slist_append(s, bc_strdup("bola3.txt"));
+ s = bc_slist_append(s, bc_strdup("bola4.txt"));
+ s = bc_slist_append(s, bc_strdup("bola5.txt"));
+ s = bc_slist_append(s, bc_strdup("bola6.txt"));
+ s = bc_slist_append(s, bc_strdup("bola7.txt"));
+ bc_trie_t *c = bc_trie_new(free);
+ bc_trie_insert(c, "FILTER_PAGE", bc_strdup("1"));
+ bc_trie_insert(c, "FILTER_PER_PAGE", bc_strdup("2"));
+ bc_slist_t *t = blogc_source_parse_from_files(c, s, &err);
assert_null(err);
assert_non_null(t);
- assert_int_equal(sb_slist_length(t), 2); // it is enough, no need to look at the items
- assert_int_equal(sb_trie_size(c), 10);
- assert_string_equal(sb_trie_lookup(c, "FILENAME_FIRST"), "bola1");
- assert_string_equal(sb_trie_lookup(c, "FILENAME_LAST"), "bola2");
- assert_string_equal(sb_trie_lookup(c, "DATE_FIRST"), "2001-02-03 04:05:06");
- assert_string_equal(sb_trie_lookup(c, "DATE_LAST"), "2002-02-03 04:05:06");
- assert_string_equal(sb_trie_lookup(c, "FILTER_PAGE"), "1");
- assert_string_equal(sb_trie_lookup(c, "FILTER_PER_PAGE"), "2");
- assert_string_equal(sb_trie_lookup(c, "CURRENT_PAGE"), "1");
- assert_string_equal(sb_trie_lookup(c, "NEXT_PAGE"), "2");
- assert_string_equal(sb_trie_lookup(c, "FIRST_PAGE"), "1");
- assert_string_equal(sb_trie_lookup(c, "LAST_PAGE"), "4");
- sb_trie_free(c);
- sb_slist_free_full(s, free);
- sb_slist_free_full(t, (sb_free_func_t) sb_trie_free);
+ assert_int_equal(bc_slist_length(t), 2); // it is enough, no need to look at the items
+ assert_int_equal(bc_trie_size(c), 10);
+ assert_string_equal(bc_trie_lookup(c, "FILENAME_FIRST"), "bola1");
+ assert_string_equal(bc_trie_lookup(c, "FILENAME_LAST"), "bola2");
+ assert_string_equal(bc_trie_lookup(c, "DATE_FIRST"), "2001-02-03 04:05:06");
+ assert_string_equal(bc_trie_lookup(c, "DATE_LAST"), "2002-02-03 04:05:06");
+ assert_string_equal(bc_trie_lookup(c, "FILTER_PAGE"), "1");
+ assert_string_equal(bc_trie_lookup(c, "FILTER_PER_PAGE"), "2");
+ assert_string_equal(bc_trie_lookup(c, "CURRENT_PAGE"), "1");
+ assert_string_equal(bc_trie_lookup(c, "NEXT_PAGE"), "2");
+ assert_string_equal(bc_trie_lookup(c, "FIRST_PAGE"), "1");
+ assert_string_equal(bc_trie_lookup(c, "LAST_PAGE"), "4");
+ bc_trie_free(c);
+ bc_slist_free_full(s, free);
+ bc_slist_free_full(t, (bc_free_func_t) bc_trie_free);
}
@@ -461,84 +461,84 @@ static void
test_source_parse_from_files_filter_by_page_and_tag(void **state)
{
will_return(__wrap_blogc_file_get_contents, "bola1.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 123\n"
"DATE: 2001-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola2.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 456\n"
"DATE: 2002-02-03 04:05:06\n"
"TAGS: chunda\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola3.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 789\n"
"DATE: 2003-02-03 04:05:06\n"
"TAGS: chunda bola\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola4.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 7891\n"
"DATE: 2004-02-03 04:05:06\n"
"TAGS: bola\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola5.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 7892\n"
"DATE: 2005-02-03 04:05:06\n"
"TAGS: chunda\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola6.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 7893\n"
"DATE: 2006-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola7.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 7894\n"
"DATE: 2007-02-03 04:05:06\n"
"TAGS: yay chunda\n"
"--------\n"
"bola"));
blogc_error_t *err = NULL;
- sb_slist_t *s = NULL;
- s = sb_slist_append(s, sb_strdup("bola1.txt"));
- s = sb_slist_append(s, sb_strdup("bola2.txt"));
- s = sb_slist_append(s, sb_strdup("bola3.txt"));
- s = sb_slist_append(s, sb_strdup("bola4.txt"));
- s = sb_slist_append(s, sb_strdup("bola5.txt"));
- s = sb_slist_append(s, sb_strdup("bola6.txt"));
- s = sb_slist_append(s, sb_strdup("bola7.txt"));
- sb_trie_t *c = sb_trie_new(free);
- sb_trie_insert(c, "FILTER_TAG", sb_strdup("chunda"));
- sb_trie_insert(c, "FILTER_PAGE", sb_strdup("2"));
- sb_trie_insert(c, "FILTER_PER_PAGE", sb_strdup("2"));
- sb_slist_t *t = blogc_source_parse_from_files(c, s, &err);
+ bc_slist_t *s = NULL;
+ s = bc_slist_append(s, bc_strdup("bola1.txt"));
+ s = bc_slist_append(s, bc_strdup("bola2.txt"));
+ s = bc_slist_append(s, bc_strdup("bola3.txt"));
+ s = bc_slist_append(s, bc_strdup("bola4.txt"));
+ s = bc_slist_append(s, bc_strdup("bola5.txt"));
+ s = bc_slist_append(s, bc_strdup("bola6.txt"));
+ s = bc_slist_append(s, bc_strdup("bola7.txt"));
+ bc_trie_t *c = bc_trie_new(free);
+ bc_trie_insert(c, "FILTER_TAG", bc_strdup("chunda"));
+ bc_trie_insert(c, "FILTER_PAGE", bc_strdup("2"));
+ bc_trie_insert(c, "FILTER_PER_PAGE", bc_strdup("2"));
+ bc_slist_t *t = blogc_source_parse_from_files(c, s, &err);
assert_null(err);
assert_non_null(t);
- assert_int_equal(sb_slist_length(t), 2); // it is enough, no need to look at the items
- assert_int_equal(sb_trie_size(c), 11);
- assert_string_equal(sb_trie_lookup(c, "FILENAME_FIRST"), "bola5");
- assert_string_equal(sb_trie_lookup(c, "FILENAME_LAST"), "bola7");
- assert_string_equal(sb_trie_lookup(c, "DATE_FIRST"), "2005-02-03 04:05:06");
- assert_string_equal(sb_trie_lookup(c, "DATE_LAST"), "2007-02-03 04:05:06");
- assert_string_equal(sb_trie_lookup(c, "FILTER_TAG"), "chunda");
- assert_string_equal(sb_trie_lookup(c, "FILTER_PAGE"), "2");
- assert_string_equal(sb_trie_lookup(c, "FILTER_PER_PAGE"), "2");
- assert_string_equal(sb_trie_lookup(c, "CURRENT_PAGE"), "2");
- assert_string_equal(sb_trie_lookup(c, "PREVIOUS_PAGE"), "1");
- assert_string_equal(sb_trie_lookup(c, "FIRST_PAGE"), "1");
- assert_string_equal(sb_trie_lookup(c, "LAST_PAGE"), "2");
- sb_trie_free(c);
- sb_slist_free_full(s, free);
- sb_slist_free_full(t, (sb_free_func_t) sb_trie_free);
+ assert_int_equal(bc_slist_length(t), 2); // it is enough, no need to look at the items
+ assert_int_equal(bc_trie_size(c), 11);
+ assert_string_equal(bc_trie_lookup(c, "FILENAME_FIRST"), "bola5");
+ assert_string_equal(bc_trie_lookup(c, "FILENAME_LAST"), "bola7");
+ assert_string_equal(bc_trie_lookup(c, "DATE_FIRST"), "2005-02-03 04:05:06");
+ assert_string_equal(bc_trie_lookup(c, "DATE_LAST"), "2007-02-03 04:05:06");
+ assert_string_equal(bc_trie_lookup(c, "FILTER_TAG"), "chunda");
+ assert_string_equal(bc_trie_lookup(c, "FILTER_PAGE"), "2");
+ assert_string_equal(bc_trie_lookup(c, "FILTER_PER_PAGE"), "2");
+ assert_string_equal(bc_trie_lookup(c, "CURRENT_PAGE"), "2");
+ assert_string_equal(bc_trie_lookup(c, "PREVIOUS_PAGE"), "1");
+ assert_string_equal(bc_trie_lookup(c, "FIRST_PAGE"), "1");
+ assert_string_equal(bc_trie_lookup(c, "LAST_PAGE"), "2");
+ bc_trie_free(c);
+ bc_slist_free_full(s, free);
+ bc_slist_free_full(t, (bc_free_func_t) bc_trie_free);
}
@@ -546,77 +546,77 @@ static void
test_source_parse_from_files_filter_by_page_invalid(void **state)
{
will_return(__wrap_blogc_file_get_contents, "bola1.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 123\n"
"DATE: 2001-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola2.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 456\n"
"DATE: 2002-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola3.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 789\n"
"DATE: 2003-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola4.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 7891\n"
"DATE: 2004-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola5.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 7892\n"
"DATE: 2005-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola6.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 7893\n"
"DATE: 2006-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola7.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 7894\n"
"DATE: 2007-02-03 04:05:06\n"
"--------\n"
"bola"));
blogc_error_t *err = NULL;
- sb_slist_t *s = NULL;
- s = sb_slist_append(s, sb_strdup("bola1.txt"));
- s = sb_slist_append(s, sb_strdup("bola2.txt"));
- s = sb_slist_append(s, sb_strdup("bola3.txt"));
- s = sb_slist_append(s, sb_strdup("bola4.txt"));
- s = sb_slist_append(s, sb_strdup("bola5.txt"));
- s = sb_slist_append(s, sb_strdup("bola6.txt"));
- s = sb_slist_append(s, sb_strdup("bola7.txt"));
- sb_trie_t *c = sb_trie_new(free);
- sb_trie_insert(c, "FILTER_PAGE", sb_strdup("-1"));
- sb_trie_insert(c, "FILTER_PER_PAGE", sb_strdup("2"));
- sb_slist_t *t = blogc_source_parse_from_files(c, s, &err);
+ bc_slist_t *s = NULL;
+ s = bc_slist_append(s, bc_strdup("bola1.txt"));
+ s = bc_slist_append(s, bc_strdup("bola2.txt"));
+ s = bc_slist_append(s, bc_strdup("bola3.txt"));
+ s = bc_slist_append(s, bc_strdup("bola4.txt"));
+ s = bc_slist_append(s, bc_strdup("bola5.txt"));
+ s = bc_slist_append(s, bc_strdup("bola6.txt"));
+ s = bc_slist_append(s, bc_strdup("bola7.txt"));
+ bc_trie_t *c = bc_trie_new(free);
+ bc_trie_insert(c, "FILTER_PAGE", bc_strdup("-1"));
+ bc_trie_insert(c, "FILTER_PER_PAGE", bc_strdup("2"));
+ bc_slist_t *t = blogc_source_parse_from_files(c, s, &err);
assert_null(err);
assert_non_null(t);
- assert_int_equal(sb_slist_length(t), 2); // it is enough, no need to look at the items
- assert_int_equal(sb_trie_size(c), 10);
- assert_string_equal(sb_trie_lookup(c, "FILENAME_FIRST"), "bola1");
- assert_string_equal(sb_trie_lookup(c, "FILENAME_LAST"), "bola2");
- assert_string_equal(sb_trie_lookup(c, "DATE_FIRST"), "2001-02-03 04:05:06");
- assert_string_equal(sb_trie_lookup(c, "DATE_LAST"), "2002-02-03 04:05:06");
- assert_string_equal(sb_trie_lookup(c, "FILTER_PAGE"), "-1");
- assert_string_equal(sb_trie_lookup(c, "FILTER_PER_PAGE"), "2");
- assert_string_equal(sb_trie_lookup(c, "CURRENT_PAGE"), "1");
- assert_string_equal(sb_trie_lookup(c, "NEXT_PAGE"), "2");
- assert_string_equal(sb_trie_lookup(c, "FIRST_PAGE"), "1");
- assert_string_equal(sb_trie_lookup(c, "LAST_PAGE"), "4");
- sb_trie_free(c);
- sb_slist_free_full(s, free);
- sb_slist_free_full(t, (sb_free_func_t) sb_trie_free);
+ assert_int_equal(bc_slist_length(t), 2); // it is enough, no need to look at the items
+ assert_int_equal(bc_trie_size(c), 10);
+ assert_string_equal(bc_trie_lookup(c, "FILENAME_FIRST"), "bola1");
+ assert_string_equal(bc_trie_lookup(c, "FILENAME_LAST"), "bola2");
+ assert_string_equal(bc_trie_lookup(c, "DATE_FIRST"), "2001-02-03 04:05:06");
+ assert_string_equal(bc_trie_lookup(c, "DATE_LAST"), "2002-02-03 04:05:06");
+ assert_string_equal(bc_trie_lookup(c, "FILTER_PAGE"), "-1");
+ assert_string_equal(bc_trie_lookup(c, "FILTER_PER_PAGE"), "2");
+ assert_string_equal(bc_trie_lookup(c, "CURRENT_PAGE"), "1");
+ assert_string_equal(bc_trie_lookup(c, "NEXT_PAGE"), "2");
+ assert_string_equal(bc_trie_lookup(c, "FIRST_PAGE"), "1");
+ assert_string_equal(bc_trie_lookup(c, "LAST_PAGE"), "4");
+ bc_trie_free(c);
+ bc_slist_free_full(s, free);
+ bc_slist_free_full(t, (bc_free_func_t) bc_trie_free);
}
@@ -624,64 +624,64 @@ static void
test_source_parse_from_files_filter_by_page_invalid2(void **state)
{
will_return(__wrap_blogc_file_get_contents, "bola1.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 123\n"
"DATE: 2001-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola2.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 456\n"
"DATE: 2002-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola3.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 789\n"
"DATE: 2003-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola4.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 7891\n"
"DATE: 2004-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola5.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 7892\n"
"DATE: 2005-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola6.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 7893\n"
"DATE: 2006-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola7.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 7894\n"
"DATE: 2007-02-03 04:05:06\n"
"--------\n"
"bola"));
blogc_error_t *err = NULL;
- sb_slist_t *s = NULL;
- s = sb_slist_append(s, sb_strdup("bola1.txt"));
- s = sb_slist_append(s, sb_strdup("bola2.txt"));
- s = sb_slist_append(s, sb_strdup("bola3.txt"));
- s = sb_slist_append(s, sb_strdup("bola4.txt"));
- s = sb_slist_append(s, sb_strdup("bola5.txt"));
- s = sb_slist_append(s, sb_strdup("bola6.txt"));
- s = sb_slist_append(s, sb_strdup("bola7.txt"));
- sb_trie_t *c = sb_trie_new(free);
- sb_trie_insert(c, "FILTER_PAGE", sb_strdup("5"));
- sb_trie_insert(c, "FILTER_PER_PAGE", sb_strdup("2"));
- sb_slist_t *t = blogc_source_parse_from_files(c, s, &err);
+ bc_slist_t *s = NULL;
+ s = bc_slist_append(s, bc_strdup("bola1.txt"));
+ s = bc_slist_append(s, bc_strdup("bola2.txt"));
+ s = bc_slist_append(s, bc_strdup("bola3.txt"));
+ s = bc_slist_append(s, bc_strdup("bola4.txt"));
+ s = bc_slist_append(s, bc_strdup("bola5.txt"));
+ s = bc_slist_append(s, bc_strdup("bola6.txt"));
+ s = bc_slist_append(s, bc_strdup("bola7.txt"));
+ bc_trie_t *c = bc_trie_new(free);
+ bc_trie_insert(c, "FILTER_PAGE", bc_strdup("5"));
+ bc_trie_insert(c, "FILTER_PER_PAGE", bc_strdup("2"));
+ bc_slist_t *t = blogc_source_parse_from_files(c, s, &err);
assert_null(err);
assert_null(t);
- sb_trie_free(c);
- sb_slist_free_full(s, free);
+ bc_trie_free(c);
+ bc_slist_free_full(s, free);
}
@@ -694,39 +694,39 @@ test_source_parse_from_files_without_all_dates(void **state)
"file, but not for all source files. This means that you may get wrong "
"values for 'DATE_FIRST' and 'DATE_LAST' variables.\n");
will_return(__wrap_blogc_file_get_contents, "bola1.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 123\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola2.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 456\n"
"DATE: 2002-02-03 04:05:06\n"
"--------\n"
"bola"));
will_return(__wrap_blogc_file_get_contents, "bola3.txt");
- will_return(__wrap_blogc_file_get_contents, sb_strdup(
+ will_return(__wrap_blogc_file_get_contents, bc_strdup(
"ASD: 789\n"
"DATE: 2003-02-03 04:05:06\n"
"--------\n"
"bola"));
blogc_error_t *err = NULL;
- sb_slist_t *s = NULL;
- s = sb_slist_append(s, sb_strdup("bola1.txt"));
- s = sb_slist_append(s, sb_strdup("bola2.txt"));
- s = sb_slist_append(s, sb_strdup("bola3.txt"));
- sb_trie_t *c = sb_trie_new(free);
- sb_slist_t *t = blogc_source_parse_from_files(c, s, &err);
+ bc_slist_t *s = NULL;
+ s = bc_slist_append(s, bc_strdup("bola1.txt"));
+ s = bc_slist_append(s, bc_strdup("bola2.txt"));
+ s = bc_slist_append(s, bc_strdup("bola3.txt"));
+ bc_trie_t *c = bc_trie_new(free);
+ bc_slist_t *t = blogc_source_parse_from_files(c, s, &err);
assert_null(err);
assert_non_null(t);
- assert_int_equal(sb_slist_length(t), 3); // it is enough, no need to look at the items
- assert_int_equal(sb_trie_size(c), 3);
- assert_string_equal(sb_trie_lookup(c, "FILENAME_FIRST"), "bola1");
- assert_string_equal(sb_trie_lookup(c, "FILENAME_LAST"), "bola3");
- assert_string_equal(sb_trie_lookup(c, "DATE_LAST"), "2003-02-03 04:05:06");
- sb_trie_free(c);
- sb_slist_free_full(s, free);
- sb_slist_free_full(t, (sb_free_func_t) sb_trie_free);
+ assert_int_equal(bc_slist_length(t), 3); // it is enough, no need to look at the items
+ assert_int_equal(bc_trie_size(c), 3);
+ assert_string_equal(bc_trie_lookup(c, "FILENAME_FIRST"), "bola1");
+ assert_string_equal(bc_trie_lookup(c, "FILENAME_LAST"), "bola3");
+ assert_string_equal(bc_trie_lookup(c, "DATE_LAST"), "2003-02-03 04:05:06");
+ bc_trie_free(c);
+ bc_slist_free_full(s, free);
+ bc_slist_free_full(t, (bc_free_func_t) bc_trie_free);
}
@@ -734,16 +734,16 @@ static void
test_source_parse_from_files_null(void **state)
{
blogc_error_t *err = NULL;
- sb_slist_t *s = NULL;
- sb_trie_t *c = sb_trie_new(free);
- sb_slist_t *t = blogc_source_parse_from_files(c, s, &err);
+ bc_slist_t *s = NULL;
+ bc_trie_t *c = bc_trie_new(free);
+ bc_slist_t *t = blogc_source_parse_from_files(c, s, &err);
assert_null(err);
assert_null(t);
- assert_int_equal(sb_slist_length(t), 0);
- assert_int_equal(sb_trie_size(c), 0);
- sb_trie_free(c);
- sb_slist_free_full(s, free);
- sb_slist_free_full(t, (sb_free_func_t) sb_trie_free);
+ assert_int_equal(bc_slist_length(t), 0);
+ assert_int_equal(bc_trie_size(c), 0);
+ bc_trie_free(c);
+ bc_slist_free_full(s, free);
+ bc_slist_free_full(t, (bc_free_func_t) bc_trie_free);
}
diff --git a/tests/blogc/check_renderer.c b/tests/blogc/check_renderer.c
index c058788..fa50601 100644
--- a/tests/blogc/check_renderer.c
+++ b/tests/blogc/check_renderer.c
@@ -20,7 +20,7 @@
#include "../../src/common/utils.h"
-static sb_slist_t*
+static bc_slist_t*
create_sources(unsigned int count)
{
const char *s[] = {
@@ -45,12 +45,12 @@ create_sources(unsigned int count)
};
assert_false(count > 3);
blogc_error_t *err = NULL;
- sb_slist_t *l = NULL;
+ bc_slist_t *l = NULL;
for (unsigned int i = 0; i < count; i++) {
- l = sb_slist_append(l, blogc_source_parse(s[i], strlen(s[i]), &err));
+ l = bc_slist_append(l, blogc_source_parse(s[i], strlen(s[i]), &err));
assert_null(err);
}
- assert_int_equal(sb_slist_length(l), count);
+ assert_int_equal(bc_slist_length(l), count);
return l;
}
@@ -77,10 +77,10 @@ test_render_entry(void **state)
"{% foreach TAGS %}lol {{ FOREACH_ITEM }} haha {% endforeach %}\n"
"{% foreach TAGS_ASD %}yay{% endforeach %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *l = blogc_template_parse(str, strlen(str), &err);
+ bc_slist_t *l = blogc_template_parse(str, strlen(str), &err);
assert_non_null(l);
assert_null(err);
- sb_slist_t *s = create_sources(1);
+ bc_slist_t *s = create_sources(1);
assert_non_null(s);
char *out = blogc_render(l, s, NULL, false);
assert_string_equal(out,
@@ -102,7 +102,7 @@ test_render_entry(void **state)
"lol foo haha lol bar haha lol baz haha \n"
"\n");
blogc_template_free_stmts(l);
- sb_slist_free_full(s, (sb_free_func_t) sb_trie_free);
+ bc_slist_free_full(s, (bc_free_func_t) bc_trie_free);
free(out);
}
@@ -124,10 +124,10 @@ test_render_listing(void **state)
"{% foreach TAGS_ASD %}yay{% endforeach %}\n"
"{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *l = blogc_template_parse(str, strlen(str), &err);
+ bc_slist_t *l = blogc_template_parse(str, strlen(str), &err);
assert_non_null(l);
assert_null(err);
- sb_slist_t *s = create_sources(3);
+ bc_slist_t *s = create_sources(3);
assert_non_null(s);
char *out = blogc_render(l, s, NULL, true);
assert_string_equal(out,
@@ -151,7 +151,7 @@ test_render_listing(void **state)
"\n"
"\n");
blogc_template_free_stmts(l);
- sb_slist_free_full(s, (sb_free_func_t) sb_trie_free);
+ bc_slist_free_full(s, (bc_free_func_t) bc_trie_free);
free(out);
}
@@ -172,7 +172,7 @@ test_render_listing_empty(void **state)
"{% foreach TAGS %}lol {{ FOREACH_ITEM }} haha {% endforeach %}\n"
"{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *l = blogc_template_parse(str, strlen(str), &err);
+ bc_slist_t *l = blogc_template_parse(str, strlen(str), &err);
assert_non_null(l);
assert_null(err);
char *out = blogc_render(l, NULL, NULL, true);
@@ -199,10 +199,10 @@ test_render_ifdef(void **state)
"{% endif %}\n"
"{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *l = blogc_template_parse(str, strlen(str), &err);
+ bc_slist_t *l = blogc_template_parse(str, strlen(str), &err);
assert_non_null(l);
assert_null(err);
- sb_slist_t *s = create_sources(1);
+ bc_slist_t *s = create_sources(1);
assert_non_null(s);
char *out = blogc_render(l, s, NULL, false);
assert_string_equal(out,
@@ -210,7 +210,7 @@ test_render_ifdef(void **state)
"\n"
"\n");
blogc_template_free_stmts(l);
- sb_slist_free_full(s, (sb_free_func_t) sb_trie_free);
+ bc_slist_free_full(s, (bc_free_func_t) bc_trie_free);
free(out);
}
@@ -228,10 +228,10 @@ test_render_ifdef2(void **state)
"{% endif %}\n"
"{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *l = blogc_template_parse(str, strlen(str), &err);
+ bc_slist_t *l = blogc_template_parse(str, strlen(str), &err);
assert_non_null(l);
assert_null(err);
- sb_slist_t *s = create_sources(1);
+ bc_slist_t *s = create_sources(1);
assert_non_null(s);
char *out = blogc_render(l, s, NULL, false);
assert_string_equal(out,
@@ -241,7 +241,7 @@ test_render_ifdef2(void **state)
"\n"
"\n");
blogc_template_free_stmts(l);
- sb_slist_free_full(s, (sb_free_func_t) sb_trie_free);
+ bc_slist_free_full(s, (bc_free_func_t) bc_trie_free);
free(out);
}
@@ -259,10 +259,10 @@ test_render_ifdef3(void **state)
"{% endif %}\n"
"{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *l = blogc_template_parse(str, strlen(str), &err);
+ bc_slist_t *l = blogc_template_parse(str, strlen(str), &err);
assert_non_null(l);
assert_null(err);
- sb_slist_t *s = create_sources(1);
+ bc_slist_t *s = create_sources(1);
assert_non_null(s);
char *out = blogc_render(l, s, NULL, false);
assert_string_equal(out,
@@ -274,7 +274,7 @@ test_render_ifdef3(void **state)
"\n"
"\n");
blogc_template_free_stmts(l);
- sb_slist_free_full(s, (sb_free_func_t) sb_trie_free);
+ bc_slist_free_full(s, (bc_free_func_t) bc_trie_free);
free(out);
}
@@ -294,10 +294,10 @@ test_render_ifdef4(void **state)
"{% endif %}\n"
"{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *l = blogc_template_parse(str, strlen(str), &err);
+ bc_slist_t *l = blogc_template_parse(str, strlen(str), &err);
assert_non_null(l);
assert_null(err);
- sb_slist_t *s = create_sources(1);
+ bc_slist_t *s = create_sources(1);
assert_non_null(s);
char *out = blogc_render(l, s, NULL, false);
assert_string_equal(out,
@@ -310,7 +310,7 @@ test_render_ifdef4(void **state)
"\n"
"\n");
blogc_template_free_stmts(l);
- sb_slist_free_full(s, (sb_free_func_t) sb_trie_free);
+ bc_slist_free_full(s, (bc_free_func_t) bc_trie_free);
free(out);
}
@@ -330,10 +330,10 @@ test_render_ifdef5(void **state)
"{% endif %}\n"
"{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *l = blogc_template_parse(str, strlen(str), &err);
+ bc_slist_t *l = blogc_template_parse(str, strlen(str), &err);
assert_non_null(l);
assert_null(err);
- sb_slist_t *s = create_sources(1);
+ bc_slist_t *s = create_sources(1);
assert_non_null(s);
char *out = blogc_render(l, s, NULL, false);
assert_string_equal(out,
@@ -344,7 +344,7 @@ test_render_ifdef5(void **state)
"\n"
"\n");
blogc_template_free_stmts(l);
- sb_slist_free_full(s, (sb_free_func_t) sb_trie_free);
+ bc_slist_free_full(s, (bc_free_func_t) bc_trie_free);
free(out);
}
@@ -364,10 +364,10 @@ test_render_ifdef6(void **state)
"{% endif %}\n"
"{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *l = blogc_template_parse(str, strlen(str), &err);
+ bc_slist_t *l = blogc_template_parse(str, strlen(str), &err);
assert_non_null(l);
assert_null(err);
- sb_slist_t *s = create_sources(1);
+ bc_slist_t *s = create_sources(1);
assert_non_null(s);
char *out = blogc_render(l, s, NULL, false);
assert_string_equal(out,
@@ -376,7 +376,7 @@ test_render_ifdef6(void **state)
"\n"
"\n");
blogc_template_free_stmts(l);
- sb_slist_free_full(s, (sb_free_func_t) sb_trie_free);
+ bc_slist_free_full(s, (bc_free_func_t) bc_trie_free);
free(out);
}
@@ -397,10 +397,10 @@ test_render_ifdef7(void **state)
"{% endif %}\n"
"{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *l = blogc_template_parse(str, strlen(str), &err);
+ bc_slist_t *l = blogc_template_parse(str, strlen(str), &err);
assert_non_null(l);
assert_null(err);
- sb_slist_t *s = create_sources(1);
+ bc_slist_t *s = create_sources(1);
assert_non_null(s);
char *out = blogc_render(l, s, NULL, false);
assert_string_equal(out,
@@ -414,7 +414,7 @@ test_render_ifdef7(void **state)
"\n"
"\n");
blogc_template_free_stmts(l);
- sb_slist_free_full(s, (sb_free_func_t) sb_trie_free);
+ bc_slist_free_full(s, (bc_free_func_t) bc_trie_free);
free(out);
}
@@ -433,10 +433,10 @@ test_render_ifndef(void **state)
"{% endif %}\n"
"{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *l = blogc_template_parse(str, strlen(str), &err);
+ bc_slist_t *l = blogc_template_parse(str, strlen(str), &err);
assert_non_null(l);
assert_null(err);
- sb_slist_t *s = create_sources(1);
+ bc_slist_t *s = create_sources(1);
assert_non_null(s);
char *out = blogc_render(l, s, NULL, false);
assert_string_equal(out,
@@ -449,7 +449,7 @@ test_render_ifndef(void **state)
"\n"
"\n");
blogc_template_free_stmts(l);
- sb_slist_free_full(s, (sb_free_func_t) sb_trie_free);
+ bc_slist_free_full(s, (bc_free_func_t) bc_trie_free);
free(out);
}
@@ -469,10 +469,10 @@ test_render_if_eq(void **state)
"{% endif %}\n"
"{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *l = blogc_template_parse(str, strlen(str), &err);
+ bc_slist_t *l = blogc_template_parse(str, strlen(str), &err);
assert_non_null(l);
assert_null(err);
- sb_slist_t *s = create_sources(1);
+ bc_slist_t *s = create_sources(1);
assert_non_null(s);
char *out = blogc_render(l, s, NULL, false);
assert_string_equal(out,
@@ -486,7 +486,7 @@ test_render_if_eq(void **state)
"\n"
"\n");
blogc_template_free_stmts(l);
- sb_slist_free_full(s, (sb_free_func_t) sb_trie_free);
+ bc_slist_free_full(s, (bc_free_func_t) bc_trie_free);
free(out);
}
@@ -506,10 +506,10 @@ test_render_if_neq(void **state)
"{% endif %}\n"
"{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *l = blogc_template_parse(str, strlen(str), &err);
+ bc_slist_t *l = blogc_template_parse(str, strlen(str), &err);
assert_non_null(l);
assert_null(err);
- sb_slist_t *s = create_sources(1);
+ bc_slist_t *s = create_sources(1);
assert_non_null(s);
char *out = blogc_render(l, s, NULL, false);
assert_string_equal(out,
@@ -523,7 +523,7 @@ test_render_if_neq(void **state)
"\n"
"\n");
blogc_template_free_stmts(l);
- sb_slist_free_full(s, (sb_free_func_t) sb_trie_free);
+ bc_slist_free_full(s, (bc_free_func_t) bc_trie_free);
free(out);
}
@@ -543,10 +543,10 @@ test_render_if_lt(void **state)
"{% endif %}\n"
"{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *l = blogc_template_parse(str, strlen(str), &err);
+ bc_slist_t *l = blogc_template_parse(str, strlen(str), &err);
assert_non_null(l);
assert_null(err);
- sb_slist_t *s = create_sources(1);
+ bc_slist_t *s = create_sources(1);
assert_non_null(s);
char *out = blogc_render(l, s, NULL, false);
assert_string_equal(out,
@@ -560,7 +560,7 @@ test_render_if_lt(void **state)
"\n"
"\n");
blogc_template_free_stmts(l);
- sb_slist_free_full(s, (sb_free_func_t) sb_trie_free);
+ bc_slist_free_full(s, (bc_free_func_t) bc_trie_free);
free(out);
}
@@ -580,10 +580,10 @@ test_render_if_gt(void **state)
"{% endif %}\n"
"{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *l = blogc_template_parse(str, strlen(str), &err);
+ bc_slist_t *l = blogc_template_parse(str, strlen(str), &err);
assert_non_null(l);
assert_null(err);
- sb_slist_t *s = create_sources(1);
+ bc_slist_t *s = create_sources(1);
assert_non_null(s);
char *out = blogc_render(l, s, NULL, false);
assert_string_equal(out,
@@ -597,7 +597,7 @@ test_render_if_gt(void **state)
"\n"
"\n");
blogc_template_free_stmts(l);
- sb_slist_free_full(s, (sb_free_func_t) sb_trie_free);
+ bc_slist_free_full(s, (bc_free_func_t) bc_trie_free);
free(out);
}
@@ -619,10 +619,10 @@ test_render_if_lt_eq(void **state)
"{% endif %}\n"
"{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *l = blogc_template_parse(str, strlen(str), &err);
+ bc_slist_t *l = blogc_template_parse(str, strlen(str), &err);
assert_non_null(l);
assert_null(err);
- sb_slist_t *s = create_sources(1);
+ bc_slist_t *s = create_sources(1);
assert_non_null(s);
char *out = blogc_render(l, s, NULL, false);
assert_string_equal(out,
@@ -638,7 +638,7 @@ test_render_if_lt_eq(void **state)
"\n"
"\n");
blogc_template_free_stmts(l);
- sb_slist_free_full(s, (sb_free_func_t) sb_trie_free);
+ bc_slist_free_full(s, (bc_free_func_t) bc_trie_free);
free(out);
}
@@ -660,10 +660,10 @@ test_render_if_gt_eq(void **state)
"{% endif %}\n"
"{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *l = blogc_template_parse(str, strlen(str), &err);
+ bc_slist_t *l = blogc_template_parse(str, strlen(str), &err);
assert_non_null(l);
assert_null(err);
- sb_slist_t *s = create_sources(1);
+ bc_slist_t *s = create_sources(1);
assert_non_null(s);
char *out = blogc_render(l, s, NULL, false);
assert_string_equal(out,
@@ -679,7 +679,7 @@ test_render_if_gt_eq(void **state)
"\n"
"\n");
blogc_template_free_stmts(l);
- sb_slist_free_full(s, (sb_free_func_t) sb_trie_free);
+ bc_slist_free_full(s, (bc_free_func_t) bc_trie_free);
free(out);
}
@@ -692,10 +692,10 @@ test_render_foreach(void **state)
"{% foreach TAGS %} {{ FOREACH_ITEM }} {% endforeach %}\n"
"{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *l = blogc_template_parse(str, strlen(str), &err);
+ bc_slist_t *l = blogc_template_parse(str, strlen(str), &err);
assert_non_null(l);
assert_null(err);
- sb_slist_t *s = create_sources(1);
+ bc_slist_t *s = create_sources(1);
assert_non_null(s);
char *out = blogc_render(l, s, NULL, false);
assert_string_equal(out,
@@ -703,7 +703,7 @@ test_render_foreach(void **state)
" foo bar baz \n"
"\n");
blogc_template_free_stmts(l);
- sb_slist_free_full(s, (sb_free_func_t) sb_trie_free);
+ bc_slist_free_full(s, (bc_free_func_t) bc_trie_free);
free(out);
}
@@ -717,10 +717,10 @@ test_render_foreach_if(void **state)
"{% endif %} {% endforeach %}\n"
"{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *l = blogc_template_parse(str, strlen(str), &err);
+ bc_slist_t *l = blogc_template_parse(str, strlen(str), &err);
assert_non_null(l);
assert_null(err);
- sb_slist_t *s = create_sources(1);
+ bc_slist_t *s = create_sources(1);
assert_non_null(s);
char *out = blogc_render(l, s, NULL, false);
assert_string_equal(out,
@@ -728,7 +728,7 @@ test_render_foreach_if(void **state)
" bar \n"
"\n");
blogc_template_free_stmts(l);
- sb_slist_free_full(s, (sb_free_func_t) sb_trie_free);
+ bc_slist_free_full(s, (bc_free_func_t) bc_trie_free);
free(out);
}
@@ -743,10 +743,10 @@ test_render_foreach_if_else(void **state)
"{% endif %} {% endforeach %}\n"
"{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *l = blogc_template_parse(str, strlen(str), &err);
+ bc_slist_t *l = blogc_template_parse(str, strlen(str), &err);
assert_non_null(l);
assert_null(err);
- sb_slist_t *s = create_sources(1);
+ bc_slist_t *s = create_sources(1);
assert_non_null(s);
char *out = blogc_render(l, s, NULL, false);
assert_string_equal(out,
@@ -754,7 +754,7 @@ test_render_foreach_if_else(void **state)
"foo yay baz \n"
"\n");
blogc_template_free_stmts(l);
- sb_slist_free_full(s, (sb_free_func_t) sb_trie_free);
+ bc_slist_free_full(s, (bc_free_func_t) bc_trie_free);
free(out);
}
@@ -774,21 +774,21 @@ test_render_outside_block(void **state)
"{{ BOLA }}\n"
"{% ifndef CHUNDA %}lol{% endif %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *l = blogc_template_parse(str, strlen(str), &err);
+ bc_slist_t *l = blogc_template_parse(str, strlen(str), &err);
assert_non_null(l);
assert_null(err);
- sb_slist_t *s = create_sources(1);
+ bc_slist_t *s = create_sources(1);
assert_non_null(s);
- sb_trie_t *c = sb_trie_new(free);
- sb_trie_insert(c, "GUDA", sb_strdup("asd"));
+ bc_trie_t *c = bc_trie_new(free);
+ bc_trie_insert(c, "GUDA", bc_strdup("asd"));
char *out = blogc_render(l, s, c, false);
assert_string_equal(out,
"bola\n"
"\n"
"lol\n");
- sb_trie_free(c);
+ bc_trie_free(c);
blogc_template_free_stmts(l);
- sb_slist_free_full(s, (sb_free_func_t) sb_trie_free);
+ bc_slist_free_full(s, (bc_free_func_t) bc_trie_free);
free(out);
}
@@ -807,14 +807,14 @@ test_render_prefer_local_variable(void **state)
"{% endif %}\n"
"{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *l = blogc_template_parse(str, strlen(str), &err);
+ bc_slist_t *l = blogc_template_parse(str, strlen(str), &err);
assert_non_null(l);
assert_null(err);
- sb_slist_t *s = create_sources(1);
+ bc_slist_t *s = create_sources(1);
assert_non_null(s);
- sb_trie_t *c = sb_trie_new(free);
- sb_trie_insert(c, "GUDA", sb_strdup("hehe"));
- sb_trie_insert(c, "LOL", sb_strdup("hmm"));
+ bc_trie_t *c = bc_trie_new(free);
+ bc_trie_insert(c, "GUDA", bc_strdup("hehe"));
+ bc_trie_insert(c, "LOL", bc_strdup("hmm"));
char *out = blogc_render(l, s, c, false);
assert_string_equal(out,
"\n"
@@ -825,9 +825,9 @@ test_render_prefer_local_variable(void **state)
"\n"
"\n"
"\n");
- sb_trie_free(c);
+ bc_trie_free(c);
blogc_template_free_stmts(l);
- sb_slist_free_full(s, (sb_free_func_t) sb_trie_free);
+ bc_slist_free_full(s, (bc_free_func_t) bc_trie_free);
free(out);
}
@@ -843,12 +843,12 @@ test_render_respect_variable_scope(void **state)
"{% ifdef BOLA %}{{ BOLA }}{% endif %}\n"
"{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *l = blogc_template_parse(str, strlen(str), &err);
+ bc_slist_t *l = blogc_template_parse(str, strlen(str), &err);
assert_non_null(l);
assert_null(err);
- sb_slist_t *s = create_sources(1);
+ bc_slist_t *s = create_sources(1);
assert_non_null(s);
- sb_trie_t *c = sb_trie_new(free);
+ bc_trie_t *c = bc_trie_new(free);
char *out = blogc_render(l, s, c, false);
assert_string_equal(out,
"\n"
@@ -857,9 +857,9 @@ test_render_respect_variable_scope(void **state)
"\n"
"asd\n"
"\n");
- sb_trie_free(c);
+ bc_trie_free(c);
blogc_template_free_stmts(l);
- sb_slist_free_full(s, (sb_free_func_t) sb_trie_free);
+ bc_slist_free_full(s, (bc_free_func_t) bc_trie_free);
free(out);
}
@@ -875,22 +875,22 @@ test_render_ifcount_bug(void **state)
"{% endif %}\n"
"{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *l = blogc_template_parse(str, strlen(str), &err);
+ bc_slist_t *l = blogc_template_parse(str, strlen(str), &err);
assert_non_null(l);
assert_null(err);
- sb_slist_t *s = NULL;
- s = sb_slist_append(s, sb_trie_new(free));
- sb_trie_insert(s->data, "TITLE", sb_strdup("bola"));
- sb_trie_t *c = sb_trie_new(free);
+ bc_slist_t *s = NULL;
+ s = bc_slist_append(s, bc_trie_new(free));
+ bc_trie_insert(s->data, "TITLE", bc_strdup("bola"));
+ bc_trie_t *c = bc_trie_new(free);
char *out = blogc_render(l, s, c, false);
assert_string_equal(out,
"\n"
"<h3>bola</h3>\n"
"\n"
"\n");
- sb_trie_free(c);
+ bc_trie_free(c);
blogc_template_free_stmts(l);
- sb_slist_free_full(s, (sb_free_func_t) sb_trie_free);
+ bc_slist_free_full(s, (bc_free_func_t) bc_trie_free);
free(out);
}
@@ -898,100 +898,100 @@ test_render_ifcount_bug(void **state)
static void
test_get_variable(void **state)
{
- sb_trie_t *g = sb_trie_new(free);
- sb_trie_insert(g, "NAME", sb_strdup("bola"));
- sb_trie_insert(g, "TITLE", sb_strdup("bola2"));
- sb_trie_t *l = sb_trie_new(free);
- sb_trie_insert(l, "NAME", sb_strdup("chunda"));
- sb_trie_insert(l, "TITLE", sb_strdup("chunda2"));
+ bc_trie_t *g = bc_trie_new(free);
+ bc_trie_insert(g, "NAME", bc_strdup("bola"));
+ bc_trie_insert(g, "TITLE", bc_strdup("bola2"));
+ bc_trie_t *l = bc_trie_new(free);
+ bc_trie_insert(l, "NAME", bc_strdup("chunda"));
+ bc_trie_insert(l, "TITLE", bc_strdup("chunda2"));
assert_string_equal(blogc_get_variable("NAME", g, l), "chunda");
assert_string_equal(blogc_get_variable("TITLE", g, l), "chunda2");
assert_null(blogc_get_variable("BOLA", g, l));
- sb_trie_free(g);
- sb_trie_free(l);
+ bc_trie_free(g);
+ bc_trie_free(l);
}
static void
test_get_variable_only_local(void **state)
{
- sb_trie_t *g = NULL;
- sb_trie_t *l = sb_trie_new(free);
- sb_trie_insert(l, "NAME", sb_strdup("chunda"));
- sb_trie_insert(l, "TITLE", sb_strdup("chunda2"));
+ bc_trie_t *g = NULL;
+ bc_trie_t *l = bc_trie_new(free);
+ bc_trie_insert(l, "NAME", bc_strdup("chunda"));
+ bc_trie_insert(l, "TITLE", bc_strdup("chunda2"));
assert_string_equal(blogc_get_variable("NAME", g, l), "chunda");
assert_string_equal(blogc_get_variable("TITLE", g, l), "chunda2");
assert_null(blogc_get_variable("BOLA", g, l));
- sb_trie_free(l);
+ bc_trie_free(l);
}
static void
test_get_variable_only_global(void **state)
{
- sb_trie_t *g = sb_trie_new(free);
- sb_trie_insert(g, "NAME", sb_strdup("bola"));
- sb_trie_insert(g, "TITLE", sb_strdup("bola2"));
- sb_trie_t *l = NULL;
+ bc_trie_t *g = bc_trie_new(free);
+ bc_trie_insert(g, "NAME", bc_strdup("bola"));
+ bc_trie_insert(g, "TITLE", bc_strdup("bola2"));
+ bc_trie_t *l = NULL;
assert_string_equal(blogc_get_variable("NAME", g, l), "bola");
assert_string_equal(blogc_get_variable("TITLE", g, l), "bola2");
assert_null(blogc_get_variable("BOLA", g, l));
- sb_trie_free(g);
+ bc_trie_free(g);
}
static void
test_format_date(void **state)
{
- sb_trie_t *g = sb_trie_new(free);
- sb_trie_insert(g, "DATE_FORMAT", sb_strdup("%H -- %M"));
- sb_trie_t *l = sb_trie_new(free);
- sb_trie_insert(l, "DATE_FORMAT", sb_strdup("%R"));
+ bc_trie_t *g = bc_trie_new(free);
+ bc_trie_insert(g, "DATE_FORMAT", bc_strdup("%H -- %M"));
+ bc_trie_t *l = bc_trie_new(free);
+ bc_trie_insert(l, "DATE_FORMAT", bc_strdup("%R"));
char *date = blogc_format_date("2015-01-02 03:04:05", g, l);
assert_string_equal(date, "03:04");
free(date);
- sb_trie_free(g);
- sb_trie_free(l);
+ bc_trie_free(g);
+ bc_trie_free(l);
}
static void
test_format_date_with_global_format(void **state)
{
- sb_trie_t *g = sb_trie_new(free);
- sb_trie_insert(g, "DATE_FORMAT", sb_strdup("%H -- %M"));
- sb_trie_t *l = sb_trie_new(free);
+ bc_trie_t *g = bc_trie_new(free);
+ bc_trie_insert(g, "DATE_FORMAT", bc_strdup("%H -- %M"));
+ bc_trie_t *l = bc_trie_new(free);
char *date = blogc_format_date("2015-01-02 03:04:05", g, l);
assert_string_equal(date, "03 -- 04");
free(date);
- sb_trie_free(g);
- sb_trie_free(l);
+ bc_trie_free(g);
+ bc_trie_free(l);
}
static void
test_format_date_without_format(void **state)
{
- sb_trie_t *g = sb_trie_new(free);
- sb_trie_t *l = sb_trie_new(free);
+ bc_trie_t *g = bc_trie_new(free);
+ bc_trie_t *l = bc_trie_new(free);
char *date = blogc_format_date("2015-01-02 03:04:05", g, l);
assert_string_equal(date, "2015-01-02 03:04:05");
free(date);
- sb_trie_free(g);
- sb_trie_free(l);
+ bc_trie_free(g);
+ bc_trie_free(l);
}
static void
test_format_date_without_date(void **state)
{
- sb_trie_t *g = sb_trie_new(free);
- sb_trie_t *l = sb_trie_new(free);
+ bc_trie_t *g = bc_trie_new(free);
+ bc_trie_t *l = bc_trie_new(free);
char *date = blogc_format_date(NULL, g, l);
assert_null(date);
free(date);
- sb_trie_free(g);
- sb_trie_free(l);
+ bc_trie_free(g);
+ bc_trie_free(l);
}
@@ -999,13 +999,13 @@ static void
test_format_variable(void **state)
{
// FIXME: test warnings
- sb_trie_t *g = sb_trie_new(free);
- sb_trie_insert(g, "NAME", sb_strdup("bola"));
- sb_trie_insert(g, "TITLE", sb_strdup("bola2"));
- sb_trie_t *l = sb_trie_new(free);
- sb_trie_insert(l, "NAME", sb_strdup("chunda"));
- sb_trie_insert(l, "TITLE", sb_strdup("chunda2"));
- sb_trie_insert(l, "SIZE", sb_strdup("1234567890987654321"));
+ bc_trie_t *g = bc_trie_new(free);
+ bc_trie_insert(g, "NAME", bc_strdup("bola"));
+ bc_trie_insert(g, "TITLE", bc_strdup("bola2"));
+ bc_trie_t *l = bc_trie_new(free);
+ bc_trie_insert(l, "NAME", bc_strdup("chunda"));
+ bc_trie_insert(l, "TITLE", bc_strdup("chunda2"));
+ bc_trie_insert(l, "SIZE", bc_strdup("1234567890987654321"));
char *tmp = blogc_format_variable("NAME", g, l, NULL);
assert_string_equal(tmp, "chunda");
free(tmp);
@@ -1023,19 +1023,19 @@ test_format_variable(void **state)
free(tmp);
assert_null(blogc_format_variable("SIZE_", g, l, NULL));
assert_null(blogc_format_variable("BOLA", g, l, NULL));
- sb_trie_free(g);
- sb_trie_free(l);
+ bc_trie_free(g);
+ bc_trie_free(l);
}
static void
test_format_variable_with_date(void **state)
{
- sb_trie_t *g = sb_trie_new(free);
- sb_trie_insert(g, "DATE", sb_strdup("2010-11-12 13:14:15"));
- sb_trie_insert(g, "DATE_FORMAT", sb_strdup("%R"));
- sb_trie_t *l = sb_trie_new(free);
- sb_trie_insert(l, "DATE", sb_strdup("2011-12-13 14:15:16"));
+ bc_trie_t *g = bc_trie_new(free);
+ bc_trie_insert(g, "DATE", bc_strdup("2010-11-12 13:14:15"));
+ bc_trie_insert(g, "DATE_FORMAT", bc_strdup("%R"));
+ bc_trie_t *l = bc_trie_new(free);
+ bc_trie_insert(l, "DATE", bc_strdup("2011-12-13 14:15:16"));
char *tmp = blogc_format_variable("DATE_FORMATTED", g, l, NULL);
assert_string_equal(tmp, "14:15");
free(tmp);
@@ -1045,18 +1045,18 @@ test_format_variable_with_date(void **state)
tmp = blogc_format_variable("DATE_FORMATTED_10", g, l, NULL);
assert_string_equal(tmp, "14:15");
free(tmp);
- sb_trie_free(g);
- sb_trie_free(l);
+ bc_trie_free(g);
+ bc_trie_free(l);
}
static void
test_format_variable_foreach(void **state)
{
- sb_slist_t *l = NULL;
- l = sb_slist_append(l, sb_strdup("asd"));
- l = sb_slist_append(l, sb_strdup("qwe"));
- l = sb_slist_append(l, sb_strdup("zxcvbn"));
+ bc_slist_t *l = NULL;
+ l = bc_slist_append(l, bc_strdup("asd"));
+ l = bc_slist_append(l, bc_strdup("qwe"));
+ l = bc_slist_append(l, bc_strdup("zxcvbn"));
char *tmp = blogc_format_variable("FOREACH_ITEM", NULL, NULL, l->next);
assert_string_equal(tmp, "qwe");
free(tmp);
@@ -1068,7 +1068,7 @@ test_format_variable_foreach(void **state)
l->next->next);
assert_string_equal(tmp, "zxcvbn");
free(tmp);
- sb_slist_free_full(l, free);
+ bc_slist_free_full(l, free);
}
@@ -1083,31 +1083,31 @@ test_format_variable_foreach_empty(void **state)
static void
test_split_list_variable(void **state)
{
- sb_trie_t *g = sb_trie_new(free);
- sb_trie_insert(g, "TAGS", sb_strdup("asd lol hehe"));
- sb_trie_t *l = sb_trie_new(free);
- sb_trie_insert(l, "TAGS", sb_strdup("asd lol XD"));
- sb_slist_t *tmp = blogc_split_list_variable("TAGS", g, l);
+ bc_trie_t *g = bc_trie_new(free);
+ bc_trie_insert(g, "TAGS", bc_strdup("asd lol hehe"));
+ bc_trie_t *l = bc_trie_new(free);
+ bc_trie_insert(l, "TAGS", bc_strdup("asd lol XD"));
+ bc_slist_t *tmp = blogc_split_list_variable("TAGS", g, l);
assert_string_equal(tmp->data, "asd");
assert_string_equal(tmp->next->data, "lol");
assert_string_equal(tmp->next->next->data, "XD");
- sb_slist_free_full(tmp, free);
- sb_trie_free(g);
- sb_trie_free(l);
+ bc_slist_free_full(tmp, free);
+ bc_trie_free(g);
+ bc_trie_free(l);
}
static void
test_split_list_variable_not_found(void **state)
{
- sb_trie_t *g = sb_trie_new(free);
- sb_trie_insert(g, "TAGS", sb_strdup("asd lol hehe"));
- sb_trie_t *l = sb_trie_new(free);
- sb_trie_insert(l, "TAGS", sb_strdup("asd lol XD"));
- sb_slist_t *tmp = blogc_split_list_variable("TAG", g, l);
+ bc_trie_t *g = bc_trie_new(free);
+ bc_trie_insert(g, "TAGS", bc_strdup("asd lol hehe"));
+ bc_trie_t *l = bc_trie_new(free);
+ bc_trie_insert(l, "TAGS", bc_strdup("asd lol XD"));
+ bc_slist_t *tmp = blogc_split_list_variable("TAG", g, l);
assert_null(tmp);
- sb_trie_free(g);
- sb_trie_free(l);
+ bc_trie_free(g);
+ bc_trie_free(l);
}
diff --git a/tests/blogc/check_source_parser.c b/tests/blogc/check_source_parser.c
index a1849eb..4606673 100644
--- a/tests/blogc/check_source_parser.c
+++ b/tests/blogc/check_source_parser.c
@@ -27,24 +27,24 @@ test_source_parse(void **state)
"\n"
"bola\n";
blogc_error_t *err = NULL;
- sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(err);
assert_non_null(source);
- assert_int_equal(sb_trie_size(source), 6);
- assert_string_equal(sb_trie_lookup(source, "VAR1"), "asd asd");
- assert_string_equal(sb_trie_lookup(source, "VAR2"), "123chunda");
- assert_string_equal(sb_trie_lookup(source, "EXCERPT"),
+ assert_int_equal(bc_trie_size(source), 6);
+ assert_string_equal(bc_trie_lookup(source, "VAR1"), "asd asd");
+ assert_string_equal(bc_trie_lookup(source, "VAR2"), "123chunda");
+ assert_string_equal(bc_trie_lookup(source, "EXCERPT"),
"<h1 id=\"this-is-a-test\">This is a test</h1>\n"
"<p>bola</p>\n");
- assert_string_equal(sb_trie_lookup(source, "CONTENT"),
+ assert_string_equal(bc_trie_lookup(source, "CONTENT"),
"<h1 id=\"this-is-a-test\">This is a test</h1>\n"
"<p>bola</p>\n");
- assert_string_equal(sb_trie_lookup(source, "RAW_CONTENT"),
+ assert_string_equal(bc_trie_lookup(source, "RAW_CONTENT"),
"# This is a test\n"
"\n"
"bola\n");
- assert_string_equal(sb_trie_lookup(source, "DESCRIPTION"), "bola");
- sb_trie_free(source);
+ assert_string_equal(bc_trie_lookup(source, "DESCRIPTION"), "bola");
+ bc_trie_free(source);
}
@@ -59,24 +59,24 @@ test_source_parse_crlf(void **state)
"\r\n"
"bola\r\n";
blogc_error_t *err = NULL;
- sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(err);
assert_non_null(source);
- assert_int_equal(sb_trie_size(source), 6);
- assert_string_equal(sb_trie_lookup(source, "VAR1"), "asd asd");
- assert_string_equal(sb_trie_lookup(source, "VAR2"), "123chunda");
- assert_string_equal(sb_trie_lookup(source, "EXCERPT"),
+ assert_int_equal(bc_trie_size(source), 6);
+ assert_string_equal(bc_trie_lookup(source, "VAR1"), "asd asd");
+ assert_string_equal(bc_trie_lookup(source, "VAR2"), "123chunda");
+ assert_string_equal(bc_trie_lookup(source, "EXCERPT"),
"<h1 id=\"this-is-a-test\">This is a test</h1>\r\n"
"<p>bola</p>\r\n");
- assert_string_equal(sb_trie_lookup(source, "CONTENT"),
+ assert_string_equal(bc_trie_lookup(source, "CONTENT"),
"<h1 id=\"this-is-a-test\">This is a test</h1>\r\n"
"<p>bola</p>\r\n");
- assert_string_equal(sb_trie_lookup(source, "RAW_CONTENT"),
+ assert_string_equal(bc_trie_lookup(source, "RAW_CONTENT"),
"# This is a test\r\n"
"\r\n"
"bola\r\n");
- assert_string_equal(sb_trie_lookup(source, "DESCRIPTION"), "bola");
- sb_trie_free(source);
+ assert_string_equal(bc_trie_lookup(source, "DESCRIPTION"), "bola");
+ bc_trie_free(source);
}
@@ -93,24 +93,24 @@ test_source_parse_with_spaces(void **state)
"\n"
"bola\n";
blogc_error_t *err = NULL;
- sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(err);
assert_non_null(source);
- assert_int_equal(sb_trie_size(source), 6);
- assert_string_equal(sb_trie_lookup(source, "VAR1"), "chunda");
- assert_string_equal(sb_trie_lookup(source, "BOLA"), "guda");
- assert_string_equal(sb_trie_lookup(source, "EXCERPT"),
+ assert_int_equal(bc_trie_size(source), 6);
+ assert_string_equal(bc_trie_lookup(source, "VAR1"), "chunda");
+ assert_string_equal(bc_trie_lookup(source, "BOLA"), "guda");
+ assert_string_equal(bc_trie_lookup(source, "EXCERPT"),
"<h1 id=\"this-is-a-test\">This is a test</h1>\n"
"<p>bola</p>\n");
- assert_string_equal(sb_trie_lookup(source, "CONTENT"),
+ assert_string_equal(bc_trie_lookup(source, "CONTENT"),
"<h1 id=\"this-is-a-test\">This is a test</h1>\n"
"<p>bola</p>\n");
- assert_string_equal(sb_trie_lookup(source, "RAW_CONTENT"),
+ assert_string_equal(bc_trie_lookup(source, "RAW_CONTENT"),
"# This is a test\n"
"\n"
"bola\n");
- assert_string_equal(sb_trie_lookup(source, "DESCRIPTION"), "bola");
- sb_trie_free(source);
+ assert_string_equal(bc_trie_lookup(source, "DESCRIPTION"), "bola");
+ bc_trie_free(source);
}
@@ -130,21 +130,21 @@ test_source_parse_with_excerpt(void **state)
"guda\n"
"yay";
blogc_error_t *err = NULL;
- sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(err);
assert_non_null(source);
- assert_int_equal(sb_trie_size(source), 6);
- assert_string_equal(sb_trie_lookup(source, "VAR1"), "asd asd");
- assert_string_equal(sb_trie_lookup(source, "VAR2"), "123chunda");
- assert_string_equal(sb_trie_lookup(source, "EXCERPT"),
+ assert_int_equal(bc_trie_size(source), 6);
+ assert_string_equal(bc_trie_lookup(source, "VAR1"), "asd asd");
+ assert_string_equal(bc_trie_lookup(source, "VAR2"), "123chunda");
+ assert_string_equal(bc_trie_lookup(source, "EXCERPT"),
"<h1 id=\"this-is-a-test\">This is a test</h1>\n"
"<p>bola</p>\n");
- assert_string_equal(sb_trie_lookup(source, "CONTENT"),
+ assert_string_equal(bc_trie_lookup(source, "CONTENT"),
"<h1 id=\"this-is-a-test\">This is a test</h1>\n"
"<p>bola</p>\n"
"<p>guda\n"
"yay</p>\n");
- assert_string_equal(sb_trie_lookup(source, "RAW_CONTENT"),
+ assert_string_equal(bc_trie_lookup(source, "RAW_CONTENT"),
"# This is a test\n"
"\n"
"bola\n"
@@ -153,8 +153,8 @@ test_source_parse_with_excerpt(void **state)
"\n"
"guda\n"
"yay");
- assert_string_equal(sb_trie_lookup(source, "DESCRIPTION"), "bola");
- sb_trie_free(source);
+ assert_string_equal(bc_trie_lookup(source, "DESCRIPTION"), "bola");
+ bc_trie_free(source);
}
@@ -170,24 +170,24 @@ test_source_parse_with_description(void **state)
"\n"
"bola\n";
blogc_error_t *err = NULL;
- sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(err);
assert_non_null(source);
- assert_int_equal(sb_trie_size(source), 6);
- assert_string_equal(sb_trie_lookup(source, "VAR1"), "asd asd");
- assert_string_equal(sb_trie_lookup(source, "VAR2"), "123chunda");
- assert_string_equal(sb_trie_lookup(source, "EXCERPT"),
+ assert_int_equal(bc_trie_size(source), 6);
+ assert_string_equal(bc_trie_lookup(source, "VAR1"), "asd asd");
+ assert_string_equal(bc_trie_lookup(source, "VAR2"), "123chunda");
+ assert_string_equal(bc_trie_lookup(source, "EXCERPT"),
"<h1 id=\"this-is-a-test\">This is a test</h1>\n"
"<p>bola</p>\n");
- assert_string_equal(sb_trie_lookup(source, "CONTENT"),
+ assert_string_equal(bc_trie_lookup(source, "CONTENT"),
"<h1 id=\"this-is-a-test\">This is a test</h1>\n"
"<p>bola</p>\n");
- assert_string_equal(sb_trie_lookup(source, "RAW_CONTENT"),
+ assert_string_equal(bc_trie_lookup(source, "RAW_CONTENT"),
"# This is a test\n"
"\n"
"bola\n");
- assert_string_equal(sb_trie_lookup(source, "DESCRIPTION"), "huehuehuebrbr");
- sb_trie_free(source);
+ assert_string_equal(bc_trie_lookup(source, "DESCRIPTION"), "huehuehuebrbr");
+ bc_trie_free(source);
}
@@ -196,13 +196,13 @@ test_source_parse_config_empty(void **state)
{
const char *a = "";
blogc_error_t *err = NULL;
- sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg, "Your source file is empty.");
blogc_error_free(err);
- sb_trie_free(source);
+ bc_trie_free(source);
}
@@ -211,14 +211,14 @@ test_source_parse_config_invalid_key(void **state)
{
const char *a = "bola: guda";
blogc_error_t *err = NULL;
- sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_non_null(err);
assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg,
"Can't find a configuration key or the content separator.\n"
"Error occurred near line 1, position 1: bola: guda");
blogc_error_free(err);
- sb_trie_free(source);
+ bc_trie_free(source);
}
@@ -227,14 +227,14 @@ test_source_parse_config_no_key(void **state)
{
const char *a = "BOLa";
blogc_error_t *err = NULL;
- sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_non_null(err);
assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg,
"Invalid configuration key.\n"
"Error occurred near line 1, position 4: BOLa");
blogc_error_free(err);
- sb_trie_free(source);
+ bc_trie_free(source);
}
@@ -243,14 +243,14 @@ test_source_parse_config_no_key2(void **state)
{
const char *a = "BOLA";
blogc_error_t *err = NULL;
- sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_non_null(err);
assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
assert_string_equal(err->msg,
"Your last configuration key is missing ':' and the value\n"
"Error occurred near line 1, position 5: BOLA");
blogc_error_free(err);
- sb_trie_free(source);
+ bc_trie_free(source);
}
@@ -259,7 +259,7 @@ test_source_parse_config_no_value(void **state)
{
const char *a = "BOLA:\r\n";
blogc_error_t *err = NULL;
- sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
@@ -267,7 +267,7 @@ test_source_parse_config_no_value(void **state)
"Configuration value not provided for 'BOLA'.\n"
"Error occurred near line 1, position 6: BOLA:");
blogc_error_free(err);
- sb_trie_free(source);
+ bc_trie_free(source);
}
@@ -276,7 +276,7 @@ test_source_parse_config_no_value2(void **state)
{
const char *a = "BOLA:";
blogc_error_t *err = NULL;
- sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
@@ -284,7 +284,7 @@ test_source_parse_config_no_value2(void **state)
"Configuration value not provided for 'BOLA'.\n"
"Error occurred near line 1, position 6: BOLA:");
blogc_error_free(err);
- sb_trie_free(source);
+ bc_trie_free(source);
}
@@ -293,7 +293,7 @@ test_source_parse_config_reserved_name(void **state)
{
const char *a = "FILENAME: asd\r\n";
blogc_error_t *err = NULL;
- sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
@@ -301,7 +301,7 @@ test_source_parse_config_reserved_name(void **state)
"'FILENAME' variable is forbidden in source files. It will be set "
"for you by the compiler.");
blogc_error_free(err);
- sb_trie_free(source);
+ bc_trie_free(source);
}
@@ -310,7 +310,7 @@ test_source_parse_config_reserved_name2(void **state)
{
const char *a = "CONTENT: asd\r\n";
blogc_error_t *err = NULL;
- sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
@@ -318,7 +318,7 @@ test_source_parse_config_reserved_name2(void **state)
"'CONTENT' variable is forbidden in source files. It will be set "
"for you by the compiler.");
blogc_error_free(err);
- sb_trie_free(source);
+ bc_trie_free(source);
}
@@ -327,7 +327,7 @@ test_source_parse_config_reserved_name3(void **state)
{
const char *a = "DATE_FORMATTED: asd\r\n";
blogc_error_t *err = NULL;
- sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
@@ -335,7 +335,7 @@ test_source_parse_config_reserved_name3(void **state)
"'DATE_FORMATTED' variable is forbidden in source files. It will be set "
"for you by the compiler.");
blogc_error_free(err);
- sb_trie_free(source);
+ bc_trie_free(source);
}
@@ -344,7 +344,7 @@ test_source_parse_config_reserved_name4(void **state)
{
const char *a = "DATE_FIRST_FORMATTED: asd\r\n";
blogc_error_t *err = NULL;
- sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
@@ -352,7 +352,7 @@ test_source_parse_config_reserved_name4(void **state)
"'DATE_FIRST_FORMATTED' variable is forbidden in source files. It will be set "
"for you by the compiler.");
blogc_error_free(err);
- sb_trie_free(source);
+ bc_trie_free(source);
}
@@ -361,7 +361,7 @@ test_source_parse_config_reserved_name5(void **state)
{
const char *a = "DATE_LAST_FORMATTED: asd\r\n";
blogc_error_t *err = NULL;
- sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
@@ -369,7 +369,7 @@ test_source_parse_config_reserved_name5(void **state)
"'DATE_LAST_FORMATTED' variable is forbidden in source files. It will be set "
"for you by the compiler.");
blogc_error_free(err);
- sb_trie_free(source);
+ bc_trie_free(source);
}
@@ -378,7 +378,7 @@ test_source_parse_config_reserved_name6(void **state)
{
const char *a = "PAGE_FIRST: asd\r\n";
blogc_error_t *err = NULL;
- sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
@@ -386,7 +386,7 @@ test_source_parse_config_reserved_name6(void **state)
"'PAGE_FIRST' variable is forbidden in source files. It will be set "
"for you by the compiler.");
blogc_error_free(err);
- sb_trie_free(source);
+ bc_trie_free(source);
}
@@ -395,7 +395,7 @@ test_source_parse_config_reserved_name7(void **state)
{
const char *a = "PAGE_PREVIOUS: asd\r\n";
blogc_error_t *err = NULL;
- sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
@@ -403,7 +403,7 @@ test_source_parse_config_reserved_name7(void **state)
"'PAGE_PREVIOUS' variable is forbidden in source files. It will be set "
"for you by the compiler.");
blogc_error_free(err);
- sb_trie_free(source);
+ bc_trie_free(source);
}
@@ -412,7 +412,7 @@ test_source_parse_config_reserved_name8(void **state)
{
const char *a = "PAGE_CURRENT: asd\r\n";
blogc_error_t *err = NULL;
- sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
@@ -420,7 +420,7 @@ test_source_parse_config_reserved_name8(void **state)
"'PAGE_CURRENT' variable is forbidden in source files. It will be set "
"for you by the compiler.");
blogc_error_free(err);
- sb_trie_free(source);
+ bc_trie_free(source);
}
@@ -429,7 +429,7 @@ test_source_parse_config_reserved_name9(void **state)
{
const char *a = "PAGE_NEXT: asd\r\n";
blogc_error_t *err = NULL;
- sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
@@ -437,7 +437,7 @@ test_source_parse_config_reserved_name9(void **state)
"'PAGE_NEXT' variable is forbidden in source files. It will be set "
"for you by the compiler.");
blogc_error_free(err);
- sb_trie_free(source);
+ bc_trie_free(source);
}
@@ -446,7 +446,7 @@ test_source_parse_config_reserved_name10(void **state)
{
const char *a = "PAGE_LAST: asd\r\n";
blogc_error_t *err = NULL;
- sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
@@ -454,7 +454,7 @@ test_source_parse_config_reserved_name10(void **state)
"'PAGE_LAST' variable is forbidden in source files. It will be set "
"for you by the compiler.");
blogc_error_free(err);
- sb_trie_free(source);
+ bc_trie_free(source);
}
@@ -463,7 +463,7 @@ test_source_parse_config_reserved_name11(void **state)
{
const char *a = "BLOGC_VERSION: 1.0\r\n";
blogc_error_t *err = NULL;
- sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
@@ -471,7 +471,7 @@ test_source_parse_config_reserved_name11(void **state)
"'BLOGC_VERSION' variable is forbidden in source files. It will be set "
"for you by the compiler.");
blogc_error_free(err);
- sb_trie_free(source);
+ bc_trie_free(source);
}
@@ -480,7 +480,7 @@ test_source_parse_config_value_no_line_ending(void **state)
{
const char *a = "BOLA: asd";
blogc_error_t *err = NULL;
- sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
@@ -488,7 +488,7 @@ test_source_parse_config_value_no_line_ending(void **state)
"No line ending after the configuration value for 'BOLA'.\n"
"Error occurred near line 1, position 10: BOLA: asd");
blogc_error_free(err);
- sb_trie_free(source);
+ bc_trie_free(source);
}
@@ -497,7 +497,7 @@ test_source_parse_invalid_separator(void **state)
{
const char *a = "BOLA: asd\n---#";
blogc_error_t *err = NULL;
- sb_trie_t *source = blogc_source_parse(a, strlen(a), &err);
+ bc_trie_t *source = blogc_source_parse(a, strlen(a), &err);
assert_null(source);
assert_non_null(err);
assert_int_equal(err->type, BLOGC_ERROR_SOURCE_PARSER);
@@ -505,7 +505,7 @@ test_source_parse_invalid_separator(void **state)
"Invalid content separator. Must be more than one '-' characters.\n"
"Error occurred near line 2, position 4: ---#");
blogc_error_free(err);
- sb_trie_free(source);
+ bc_trie_free(source);
}
diff --git a/tests/blogc/check_template_parser.c b/tests/blogc/check_template_parser.c
index 3c88fe4..b4c978f 100644
--- a/tests/blogc/check_template_parser.c
+++ b/tests/blogc/check_template_parser.c
@@ -17,7 +17,7 @@
static void
-blogc_assert_template_stmt(sb_slist_t *l, const char *value,
+blogc_assert_template_stmt(bc_slist_t *l, const char *value,
const blogc_template_stmt_type_t type)
{
blogc_template_stmt_t *stmt = l->data;
@@ -30,7 +30,7 @@ blogc_assert_template_stmt(sb_slist_t *l, const char *value,
static void
-blogc_assert_template_if_stmt(sb_slist_t *l, const char *variable,
+blogc_assert_template_if_stmt(bc_slist_t *l, const char *variable,
blogc_template_stmt_operator_t operator, const char *operand)
{
blogc_template_stmt_t *stmt = l->data;
@@ -60,7 +60,7 @@ test_template_parse(void **state)
"{%- foreach BOLA %}hahaha{% endforeach %}\n"
"{% if BOLA == \"1\\\"0\" %}aee{% else %}fffuuuuuuu{% endif %}";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_null(err);
assert_non_null(stmts);
blogc_assert_template_stmt(stmts, "Test",
@@ -77,7 +77,7 @@ test_template_parse(void **state)
BLOGC_TEMPLATE_ENDIF_STMT);
blogc_assert_template_stmt(stmts->next->next->next->next->next->next, "\n",
BLOGC_TEMPLATE_CONTENT_STMT);
- sb_slist_t *tmp = stmts->next->next->next->next->next->next->next;
+ bc_slist_t *tmp = stmts->next->next->next->next->next->next->next;
blogc_assert_template_stmt(tmp, "BOLA", BLOGC_TEMPLATE_IFNDEF_STMT);
blogc_assert_template_stmt(tmp->next, "\nbolao", BLOGC_TEMPLATE_CONTENT_STMT);
blogc_assert_template_stmt(tmp->next->next, NULL, BLOGC_TEMPLATE_ENDIF_STMT);
@@ -144,7 +144,7 @@ test_template_parse_crlf(void **state)
"{%- foreach BOLA %}hahaha{% endforeach %}\r\n"
"{% if BOLA == \"1\\\"0\" %}aee{% else %}fffuuuuuuu{% endif %}";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_null(err);
assert_non_null(stmts);
blogc_assert_template_stmt(stmts, "Test",
@@ -161,7 +161,7 @@ test_template_parse_crlf(void **state)
BLOGC_TEMPLATE_ENDIF_STMT);
blogc_assert_template_stmt(stmts->next->next->next->next->next->next, "\r\n",
BLOGC_TEMPLATE_CONTENT_STMT);
- sb_slist_t *tmp = stmts->next->next->next->next->next->next->next;
+ bc_slist_t *tmp = stmts->next->next->next->next->next->next->next;
blogc_assert_template_stmt(tmp, "BOLA", BLOGC_TEMPLATE_IFNDEF_STMT);
blogc_assert_template_stmt(tmp->next, "\r\nbolao", BLOGC_TEMPLATE_CONTENT_STMT);
blogc_assert_template_stmt(tmp->next->next, NULL, BLOGC_TEMPLATE_ENDIF_STMT);
@@ -236,7 +236,7 @@ test_template_parse_html(void **state)
" </body>\n"
"</html>\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_null(err);
assert_non_null(stmts);
blogc_assert_template_stmt(stmts, "<html>\n <head>\n ",
@@ -255,7 +255,7 @@ test_template_parse_html(void **state)
"\n ", BLOGC_TEMPLATE_CONTENT_STMT);
blogc_assert_template_stmt(stmts->next->next->next->next->next->next->next,
"listing_once", BLOGC_TEMPLATE_BLOCK_STMT);
- sb_slist_t *tmp = stmts->next->next->next->next->next->next->next->next;
+ bc_slist_t *tmp = stmts->next->next->next->next->next->next->next->next;
blogc_assert_template_stmt(tmp,
"\n <title>My cool blog - Main page</title>\n ",
BLOGC_TEMPLATE_CONTENT_STMT);
@@ -346,7 +346,7 @@ test_template_parse_ifdef_and_var_outside_block(void **state)
"{{ BOLA }}\n"
"{% ifndef CHUNDA %}{{ CHUNDA }}{% endif %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_null(err);
assert_non_null(stmts);
blogc_assert_template_stmt(stmts, "GUDA", BLOGC_TEMPLATE_IFDEF_STMT);
@@ -362,7 +362,7 @@ test_template_parse_ifdef_and_var_outside_block(void **state)
BLOGC_TEMPLATE_CONTENT_STMT);
blogc_assert_template_stmt(stmts->next->next->next->next->next->next,
"CHUNDA", BLOGC_TEMPLATE_IFNDEF_STMT);
- sb_slist_t *tmp = stmts->next->next->next->next->next->next->next;
+ bc_slist_t *tmp = stmts->next->next->next->next->next->next->next;
blogc_assert_template_stmt(tmp, "CHUNDA", BLOGC_TEMPLATE_VARIABLE_STMT);
blogc_assert_template_stmt(tmp->next, NULL, BLOGC_TEMPLATE_ENDIF_STMT);
blogc_assert_template_stmt(tmp->next->next, "\n",
@@ -393,7 +393,7 @@ test_template_parse_nested_else(void **state)
"{% endif %}\n"
"{% endif %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_null(err);
assert_non_null(stmts);
blogc_assert_template_stmt(stmts, "GUDA", BLOGC_TEMPLATE_IFDEF_STMT);
@@ -409,7 +409,7 @@ test_template_parse_nested_else(void **state)
"CHUNDA", BLOGC_TEMPLATE_IFDEF_STMT);
blogc_assert_template_stmt(stmts->next->next->next->next->next->next->next,
"\nqwe\n", BLOGC_TEMPLATE_CONTENT_STMT);
- sb_slist_t *tmp = stmts->next->next->next->next->next->next->next->next;
+ bc_slist_t *tmp = stmts->next->next->next->next->next->next->next->next;
blogc_assert_template_stmt(tmp, NULL, BLOGC_TEMPLATE_ELSE_STMT);
blogc_assert_template_stmt(tmp->next, "\nrty\n", BLOGC_TEMPLATE_CONTENT_STMT);
blogc_assert_template_stmt(tmp->next->next, NULL,
@@ -445,7 +445,7 @@ test_template_parse_invalid_block_start(void **state)
{
const char *a = "{% ASD %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -483,7 +483,7 @@ test_template_parse_invalid_block_nested(void **state)
"{% block entry %}\n"
"{% block listing %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -501,7 +501,7 @@ test_template_parse_invalid_foreach_nested(void **state)
"{% foreach A %}\n"
"{% foreach B %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -517,7 +517,7 @@ test_template_parse_invalid_block_not_open(void **state)
{
const char *a = "{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -533,7 +533,7 @@ test_template_parse_invalid_endif_not_open(void **state)
{
const char *a = "{% block listing %}{% endif %}{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -550,7 +550,7 @@ test_template_parse_invalid_endif_not_open_inside_block(void **state)
{
const char *a = "{% ifdef BOLA %}{% block listing %}{% endif %}{% endblock %}";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -567,7 +567,7 @@ test_template_parse_invalid_else_not_open_inside_block(void **state)
{
const char *a = "{% ifdef BOLA %}{% block listing %}{% else %}{% endif %}{% endblock %}";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -584,7 +584,7 @@ test_template_parse_invalid_endforeach_not_open(void **state)
{
const char *a = "{% endforeach %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -601,7 +601,7 @@ test_template_parse_invalid_endforeach_not_open_inside_block(void **state)
const char *a = "{% foreach TAGS %}{% block entry %}{% endforeach %}"
"{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -619,7 +619,7 @@ test_template_parse_invalid_endforeach_not_open_inside_block2(void **state)
const char *a = "{% block entry %}{% foreach TAGS %}"
"{% endforeach %}{% endforeach %}{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -637,7 +637,7 @@ test_template_parse_invalid_endforeach_not_closed_inside_block(void **state)
const char *a = "{% block entry %}{% foreach TAGS %}{% endblock %}"
"{% endforeach %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -653,7 +653,7 @@ test_template_parse_invalid_endforeach_not_closed_inside_block2(void **state)
const char *a = "{% block entry %}{% foreach TAGS %}{% endforeach %}"
"{% foreach TAGS %}{% endblock %}{% endforeach %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -668,7 +668,7 @@ test_template_parse_invalid_block_name(void **state)
{
const char *a = "{% chunda %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -685,7 +685,7 @@ test_template_parse_invalid_block_type_start(void **state)
{
const char *a = "{% block ENTRY %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -701,7 +701,7 @@ test_template_parse_invalid_block_type(void **state)
{
const char *a = "{% block chunda %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -717,7 +717,7 @@ test_template_parse_invalid_ifdef_start(void **state)
{
const char *a = "{% block entry %}{% ifdef guda %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -734,7 +734,7 @@ test_template_parse_invalid_foreach_start(void **state)
{
const char *a = "{% block entry %}{% foreach guda %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -751,7 +751,7 @@ test_template_parse_invalid_ifdef_variable(void **state)
{
const char *a = "{% block entry %}{% ifdef BoLA %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -768,7 +768,7 @@ test_template_parse_invalid_ifdef_variable2(void **state)
{
const char *a = "{% block entry %}{% ifdef 0123 %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -785,7 +785,7 @@ test_template_parse_invalid_foreach_variable(void **state)
{
const char *a = "{% block entry %}{% foreach BoLA %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -802,7 +802,7 @@ test_template_parse_invalid_foreach_variable2(void **state)
{
const char *a = "{% block entry %}{% foreach 0123 %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -819,7 +819,7 @@ test_template_parse_invalid_if_operator(void **state)
{
const char *a = "{% block entry %}{% if BOLA = \"asd\" %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -836,7 +836,7 @@ test_template_parse_invalid_if_operand(void **state)
{
const char *a = "{% block entry %}{% if BOLA == asd %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -853,7 +853,7 @@ test_template_parse_invalid_if_operand2(void **state)
{
const char *a = "{% block entry %}{% if BOLA == \"asd %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -870,7 +870,7 @@ test_template_parse_invalid_if_operand3(void **state)
{
const char *a = "{% block entry %}{% if BOLA == 0123 %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -887,7 +887,7 @@ test_template_parse_invalid_else1(void **state)
{
const char *a = "{% else %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -903,7 +903,7 @@ test_template_parse_invalid_else2(void **state)
{
const char *a = "{% if BOLA == \"123\" %}{% if GUDA == \"1\" %}{% else %}{% else %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -927,7 +927,7 @@ test_template_parse_invalid_else3(void **state)
"{% else %}\n"
"{% else %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -943,7 +943,7 @@ test_template_parse_invalid_block_end(void **state)
{
const char *a = "{% block entry }}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -959,7 +959,7 @@ test_template_parse_invalid_variable_name(void **state)
{
const char *a = "{% block entry %}{{ bola }}{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -976,7 +976,7 @@ test_template_parse_invalid_variable_name2(void **state)
{
const char *a = "{% block entry %}{{ Bola }}{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -993,7 +993,7 @@ test_template_parse_invalid_variable_name3(void **state)
{
const char *a = "{% block entry %}{{ 0123 }}{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -1010,7 +1010,7 @@ test_template_parse_invalid_variable_end(void **state)
{
const char *a = "{% block entry %}{{ BOLA %}{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -1027,7 +1027,7 @@ test_template_parse_invalid_close(void **state)
{
const char *a = "{% block entry %%\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -1043,7 +1043,7 @@ test_template_parse_invalid_close2(void **state)
{
const char *a = "{% block entry %}{{ BOLA }%{% endblock %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -1060,7 +1060,7 @@ test_template_parse_invalid_endif_not_closed(void **state)
{
const char *a = "{% block entry %}{% endblock %}{% ifdef BOLA %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -1075,7 +1075,7 @@ test_template_parse_invalid_endif_not_closed_inside_block(void **state)
{
const char *a = "{% block listing %}{% ifdef BOLA %}{% endblock %}{% endif %}";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -1091,7 +1091,7 @@ test_template_parse_invalid_else_not_closed_inside_block(void **state)
{
const char *a = "{% block listing %}{% ifdef BOLA %}{% else %}{% endblock %}{% endif %}";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -1107,7 +1107,7 @@ test_template_parse_invalid_block_not_closed(void **state)
{
const char *a = "{% block entry %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
@@ -1121,7 +1121,7 @@ test_template_parse_invalid_foreach_not_closed(void **state)
{
const char *a = "{% foreach ASD %}\n";
blogc_error_t *err = NULL;
- sb_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
+ bc_slist_t *stmts = blogc_template_parse(a, strlen(a), &err);
assert_non_null(err);
assert_null(stmts);
assert_int_equal(err->type, BLOGC_ERROR_TEMPLATE_PARSER);
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);
}