diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-09-03 20:42:17 +0200 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-09-03 20:42:17 +0200 |
commit | a319fe44f6d50d25f546e17ad9907eedd9a358a0 (patch) | |
tree | 4fdca76c71af9cc78ae2683fa3d8a1589a78d71c /tests/blogc | |
parent | 6c5adce7b557c696cb6b5a5ebd4cd1e9380ac419 (diff) | |
download | blogc-a319fe44f6d50d25f546e17ad9907eedd9a358a0.tar.gz blogc-a319fe44f6d50d25f546e17ad9907eedd9a358a0.tar.bz2 blogc-a319fe44f6d50d25f546e17ad9907eedd9a358a0.zip |
*: s/sb_/bc_/g
Diffstat (limited to 'tests/blogc')
-rw-r--r-- | tests/blogc/check_loader.c | 544 | ||||
-rw-r--r-- | tests/blogc/check_renderer.c | 320 | ||||
-rw-r--r-- | tests/blogc/check_source_parser.c | 166 | ||||
-rw-r--r-- | tests/blogc/check_template_parser.c | 104 |
4 files changed, 567 insertions, 567 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); |