From c43b487246fdfd2ddc5c794763b18255ac6a318e Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Thu, 5 Apr 2018 22:35:25 +0200 Subject: *: use squareball yeah, changed my mind again :) --- tests/blogc-make/check_atom.c | 36 ++++---- tests/blogc-make/check_exec.c | 102 +++++++++++----------- tests/blogc-make/check_rules.c | 80 +++++++++--------- tests/blogc-make/check_settings.c | 172 +++++++++++++++++++------------------- 4 files changed, 194 insertions(+), 196 deletions(-) (limited to 'tests/blogc-make') diff --git a/tests/blogc-make/check_atom.c b/tests/blogc-make/check_atom.c index 6faa53e..9c17a61 100644 --- a/tests/blogc-make/check_atom.c +++ b/tests/blogc-make/check_atom.c @@ -13,31 +13,29 @@ #include #include +#include #include "../../src/blogc-make/atom.h" #include "../../src/blogc-make/settings.h" -#include "../../src/common/file.h" -#include "../../src/common/error.h" -#include "../../src/common/utils.h" static void test_atom_file(void **state) { - bm_settings_t *settings = bc_malloc(sizeof(bm_settings_t)); - settings->settings = bc_trie_new(free); - bc_trie_insert(settings->settings, "atom_prefix", bc_strdup("atom")); - bc_trie_insert(settings->settings, "atom_ext", bc_strdup(".xml")); - bc_trie_insert(settings->settings, "post_prefix", bc_strdup("post")); + bm_settings_t *settings = sb_malloc(sizeof(bm_settings_t)); + settings->settings = sb_trie_new(free); + sb_trie_insert(settings->settings, "atom_prefix", sb_strdup("atom")); + sb_trie_insert(settings->settings, "atom_ext", sb_strdup(".xml")); + sb_trie_insert(settings->settings, "post_prefix", sb_strdup("post")); - bc_error_t *err = NULL; + sb_error_t *err = NULL; char *rv = bm_atom_deploy(settings, &err); assert_non_null(rv); assert_null(err); size_t cmp_len; - char *cmp = bc_file_get_contents(rv, true, &cmp_len, &err); + char *cmp = sb_file_get_contents_utf8(rv, &cmp_len, &err); assert_non_null(cmp); assert_null(err); @@ -77,7 +75,7 @@ test_atom_file(void **state) free(cmp); bm_atom_destroy(rv); free(rv); - bc_trie_free(settings->settings); + sb_trie_free(settings->settings); free(settings); } @@ -85,20 +83,20 @@ test_atom_file(void **state) static void test_atom_dir(void **state) { - bm_settings_t *settings = bc_malloc(sizeof(bm_settings_t)); - settings->settings = bc_trie_new(free); - bc_trie_insert(settings->settings, "atom_prefix", bc_strdup("atom")); - bc_trie_insert(settings->settings, "atom_ext", bc_strdup("/index.xml")); - bc_trie_insert(settings->settings, "post_prefix", bc_strdup("post")); + bm_settings_t *settings = sb_malloc(sizeof(bm_settings_t)); + settings->settings = sb_trie_new(free); + sb_trie_insert(settings->settings, "atom_prefix", sb_strdup("atom")); + sb_trie_insert(settings->settings, "atom_ext", sb_strdup("/index.xml")); + sb_trie_insert(settings->settings, "post_prefix", sb_strdup("post")); - bc_error_t *err = NULL; + sb_error_t *err = NULL; char *rv = bm_atom_deploy(settings, &err); assert_non_null(rv); assert_null(err); size_t cmp_len; - char *cmp = bc_file_get_contents(rv, true, &cmp_len, &err); + char *cmp = sb_file_get_contents_utf8(rv, &cmp_len, &err); assert_non_null(cmp); assert_null(err); @@ -138,7 +136,7 @@ test_atom_dir(void **state) free(cmp); bm_atom_destroy(rv); free(rv); - bc_trie_free(settings->settings); + sb_trie_free(settings->settings); free(settings); } diff --git a/tests/blogc-make/check_exec.c b/tests/blogc-make/check_exec.c index c3a8193..6be3074 100644 --- a/tests/blogc-make/check_exec.c +++ b/tests/blogc-make/check_exec.c @@ -18,10 +18,10 @@ #include #include #include +#include #include "../../src/blogc-make/exec.h" #include "../../src/blogc-make/settings.h" -#include "../../src/common/utils.h" int @@ -75,16 +75,16 @@ test_find_binary(void **state) static void test_build_blogc_cmd_with_settings(void **state) { - bm_settings_t *settings = bc_malloc(sizeof(bm_settings_t)); - settings->settings = bc_trie_new(free); - bc_trie_insert(settings->settings, "locale", bc_strdup("en_US.utf8")); - settings->global = bc_trie_new(free); - bc_trie_insert(settings->global, "FOO", bc_strdup("BAR")); - bc_trie_insert(settings->global, "BAR", bc_strdup("BAZ")); - bc_trie_t *variables = bc_trie_new(free); - bc_trie_insert(variables, "LOL", bc_strdup("HEHE")); - bc_trie_t *local = bc_trie_new(free); - bc_trie_insert(local, "ASD", bc_strdup("QWE")); + bm_settings_t *settings = sb_malloc(sizeof(bm_settings_t)); + settings->settings = sb_trie_new(free); + sb_trie_insert(settings->settings, "locale", sb_strdup("en_US.utf8")); + settings->global = sb_trie_new(free); + sb_trie_insert(settings->global, "FOO", sb_strdup("BAR")); + sb_trie_insert(settings->global, "BAR", sb_strdup("BAZ")); + sb_trie_t *variables = sb_trie_new(free); + sb_trie_insert(variables, "LOL", sb_strdup("HEHE")); + sb_trie_t *local = sb_trie_new(free); + sb_trie_insert(local, "ASD", sb_strdup("QWE")); settings->tags = NULL; char *rv = bm_exec_build_blogc_cmd("blogc", settings, variables, local, true, @@ -106,10 +106,10 @@ test_build_blogc_cmd_with_settings(void **state) "LC_ALL='en_US.utf8' blogc -D FOO='BAR' -D BAR='BAZ'"); free(rv); - bc_trie_free(local); - bc_trie_free(variables); - bc_trie_free(settings->settings); - bc_trie_free(settings->global); + sb_trie_free(local); + sb_trie_free(variables); + sb_trie_free(settings->settings); + sb_trie_free(settings->global); free(settings); } @@ -117,16 +117,16 @@ test_build_blogc_cmd_with_settings(void **state) static void test_build_blogc_cmd_with_settings_and_dev(void **state) { - bm_settings_t *settings = bc_malloc(sizeof(bm_settings_t)); - settings->settings = bc_trie_new(free); - bc_trie_insert(settings->settings, "locale", bc_strdup("en_US.utf8")); - settings->global = bc_trie_new(free); - bc_trie_insert(settings->global, "FOO", bc_strdup("BAR")); - bc_trie_insert(settings->global, "BAR", bc_strdup("BAZ")); - bc_trie_t *variables = bc_trie_new(free); - bc_trie_insert(variables, "LOL", bc_strdup("HEHE")); - bc_trie_t *local = bc_trie_new(free); - bc_trie_insert(local, "ASD", bc_strdup("QWE")); + bm_settings_t *settings = sb_malloc(sizeof(bm_settings_t)); + settings->settings = sb_trie_new(free); + sb_trie_insert(settings->settings, "locale", sb_strdup("en_US.utf8")); + settings->global = sb_trie_new(free); + sb_trie_insert(settings->global, "FOO", sb_strdup("BAR")); + sb_trie_insert(settings->global, "BAR", sb_strdup("BAZ")); + sb_trie_t *variables = sb_trie_new(free); + sb_trie_insert(variables, "LOL", sb_strdup("HEHE")); + sb_trie_t *local = sb_trie_new(free); + sb_trie_insert(local, "ASD", sb_strdup("QWE")); settings->tags = NULL; char *rv = bm_exec_build_blogc_cmd("blogc", settings, variables, local, true, @@ -151,10 +151,10 @@ test_build_blogc_cmd_with_settings_and_dev(void **state) "-D MAKE_ENV_DEV=1 -D MAKE_ENV='dev'"); free(rv); - bc_trie_free(local); - bc_trie_free(variables); - bc_trie_free(settings->settings); - bc_trie_free(settings->global); + sb_trie_free(local); + sb_trie_free(variables); + sb_trie_free(settings->settings); + sb_trie_free(settings->global); free(settings); } @@ -162,17 +162,17 @@ test_build_blogc_cmd_with_settings_and_dev(void **state) static void test_build_blogc_cmd_with_settings_and_tags(void **state) { - bm_settings_t *settings = bc_malloc(sizeof(bm_settings_t)); - settings->settings = bc_trie_new(free); - bc_trie_insert(settings->settings, "locale", bc_strdup("en_US.utf8")); - settings->global = bc_trie_new(free); - bc_trie_insert(settings->global, "FOO", bc_strdup("BAR")); - bc_trie_insert(settings->global, "BAR", bc_strdup("BAZ")); - bc_trie_t *variables = bc_trie_new(free); - bc_trie_insert(variables, "LOL", bc_strdup("HEHE")); - bc_trie_t *local = bc_trie_new(free); - bc_trie_insert(local, "ASD", bc_strdup("QWE")); - settings->tags = bc_str_split("asd foo bar", ' ', 0); + bm_settings_t *settings = sb_malloc(sizeof(bm_settings_t)); + settings->settings = sb_trie_new(free); + sb_trie_insert(settings->settings, "locale", sb_strdup("en_US.utf8")); + settings->global = sb_trie_new(free); + sb_trie_insert(settings->global, "FOO", sb_strdup("BAR")); + sb_trie_insert(settings->global, "BAR", sb_strdup("BAZ")); + sb_trie_t *variables = sb_trie_new(free); + sb_trie_insert(variables, "LOL", sb_strdup("HEHE")); + sb_trie_t *local = sb_trie_new(free); + sb_trie_insert(local, "ASD", sb_strdup("QWE")); + settings->tags = sb_str_split("asd foo bar", ' ', 0); char *rv = bm_exec_build_blogc_cmd("blogc", settings, variables, local, true, "main.tmpl", "foo.html", true, true); @@ -196,11 +196,11 @@ test_build_blogc_cmd_with_settings_and_tags(void **state) "-D BAR='BAZ' -D MAKE_ENV_DEV=1 -D MAKE_ENV='dev'"); free(rv); - bc_trie_free(local); - bc_trie_free(variables); - bc_trie_free(settings->settings); - bc_trie_free(settings->global); - bc_strv_free(settings->tags); + sb_trie_free(local); + sb_trie_free(variables); + sb_trie_free(settings->settings); + sb_trie_free(settings->global); + sb_strv_free(settings->tags); free(settings); } @@ -208,10 +208,10 @@ test_build_blogc_cmd_with_settings_and_tags(void **state) static void test_build_blogc_cmd_without_settings(void **state) { - bc_trie_t *variables = bc_trie_new(free); - bc_trie_insert(variables, "LOL", bc_strdup("HEHE")); - bc_trie_t *local = bc_trie_new(free); - bc_trie_insert(local, "ASD", bc_strdup("QWE")); + sb_trie_t *variables = sb_trie_new(free); + sb_trie_insert(variables, "LOL", sb_strdup("HEHE")); + sb_trie_t *local = sb_trie_new(free); + sb_trie_insert(local, "ASD", sb_strdup("QWE")); char *rv = bm_exec_build_blogc_cmd("blogc", NULL, variables, local, true, "main.tmpl", "foo.html", false, true); @@ -231,8 +231,8 @@ test_build_blogc_cmd_without_settings(void **state) "blogc"); free(rv); - bc_trie_free(local); - bc_trie_free(variables); + sb_trie_free(local); + sb_trie_free(variables); } diff --git a/tests/blogc-make/check_rules.c b/tests/blogc-make/check_rules.c index c8bd9a8..3154380 100644 --- a/tests/blogc-make/check_rules.c +++ b/tests/blogc-make/check_rules.c @@ -13,70 +13,70 @@ #include #include +#include #include "../../src/blogc-make/rules.h" -#include "../../src/common/utils.h" static void test_rule_parse_args(void **state) { - bc_trie_t *t = bm_rule_parse_args("bola:foo=" + 4); + sb_trie_t *t = bm_rule_parse_args("bola:foo=" + 4); assert_non_null(t); - assert_int_equal(bc_trie_size(t), 1); - assert_string_equal(bc_trie_lookup(t, "foo"), ""); - bc_trie_free(t); + assert_int_equal(sb_trie_size(t), 1); + assert_string_equal(sb_trie_lookup(t, "foo"), ""); + sb_trie_free(t); t = bm_rule_parse_args("bola:foo=bar" + 4); assert_non_null(t); - assert_int_equal(bc_trie_size(t), 1); - assert_string_equal(bc_trie_lookup(t, "foo"), "bar"); - bc_trie_free(t); + assert_int_equal(sb_trie_size(t), 1); + assert_string_equal(sb_trie_lookup(t, "foo"), "bar"); + sb_trie_free(t); t = bm_rule_parse_args("bola:foo=,baz=lol" + 4); assert_non_null(t); - assert_int_equal(bc_trie_size(t), 2); - assert_string_equal(bc_trie_lookup(t, "foo"), ""); - assert_string_equal(bc_trie_lookup(t, "baz"), "lol"); - bc_trie_free(t); + assert_int_equal(sb_trie_size(t), 2); + assert_string_equal(sb_trie_lookup(t, "foo"), ""); + assert_string_equal(sb_trie_lookup(t, "baz"), "lol"); + sb_trie_free(t); t = bm_rule_parse_args("bola:foo=bar,baz=" + 4); assert_non_null(t); - assert_int_equal(bc_trie_size(t), 2); - assert_string_equal(bc_trie_lookup(t, "foo"), "bar"); - assert_string_equal(bc_trie_lookup(t, "baz"), ""); - bc_trie_free(t); + assert_int_equal(sb_trie_size(t), 2); + assert_string_equal(sb_trie_lookup(t, "foo"), "bar"); + assert_string_equal(sb_trie_lookup(t, "baz"), ""); + sb_trie_free(t); t = bm_rule_parse_args("bola:foo=bar,baz=lol" + 4); assert_non_null(t); - assert_int_equal(bc_trie_size(t), 2); - assert_string_equal(bc_trie_lookup(t, "foo"), "bar"); - assert_string_equal(bc_trie_lookup(t, "baz"), "lol"); - bc_trie_free(t); + assert_int_equal(sb_trie_size(t), 2); + assert_string_equal(sb_trie_lookup(t, "foo"), "bar"); + assert_string_equal(sb_trie_lookup(t, "baz"), "lol"); + sb_trie_free(t); t = bm_rule_parse_args("bola:foo=,baz=lol,asd=qwe" + 4); assert_non_null(t); - assert_int_equal(bc_trie_size(t), 3); - assert_string_equal(bc_trie_lookup(t, "foo"), ""); - assert_string_equal(bc_trie_lookup(t, "baz"), "lol"); - assert_string_equal(bc_trie_lookup(t, "asd"), "qwe"); - bc_trie_free(t); + assert_int_equal(sb_trie_size(t), 3); + assert_string_equal(sb_trie_lookup(t, "foo"), ""); + assert_string_equal(sb_trie_lookup(t, "baz"), "lol"); + assert_string_equal(sb_trie_lookup(t, "asd"), "qwe"); + sb_trie_free(t); t = bm_rule_parse_args("bola:foo=bar,baz=,asd=qwe" + 4); assert_non_null(t); - assert_int_equal(bc_trie_size(t), 3); - assert_string_equal(bc_trie_lookup(t, "foo"), "bar"); - assert_string_equal(bc_trie_lookup(t, "baz"), ""); - assert_string_equal(bc_trie_lookup(t, "asd"), "qwe"); - bc_trie_free(t); + assert_int_equal(sb_trie_size(t), 3); + assert_string_equal(sb_trie_lookup(t, "foo"), "bar"); + assert_string_equal(sb_trie_lookup(t, "baz"), ""); + assert_string_equal(sb_trie_lookup(t, "asd"), "qwe"); + sb_trie_free(t); t = bm_rule_parse_args("bola:foo=bar,baz=lol,asd=" + 4); assert_non_null(t); - assert_int_equal(bc_trie_size(t), 3); - assert_string_equal(bc_trie_lookup(t, "foo"), "bar"); - assert_string_equal(bc_trie_lookup(t, "baz"), "lol"); - assert_string_equal(bc_trie_lookup(t, "asd"), ""); - bc_trie_free(t); + assert_int_equal(sb_trie_size(t), 3); + assert_string_equal(sb_trie_lookup(t, "foo"), "bar"); + assert_string_equal(sb_trie_lookup(t, "baz"), "lol"); + assert_string_equal(sb_trie_lookup(t, "asd"), ""); + sb_trie_free(t); t = bm_rule_parse_args("bola:foo=bar,baz=lol,asd=qwe" + 4); assert_non_null(t); - assert_int_equal(bc_trie_size(t), 3); - assert_string_equal(bc_trie_lookup(t, "foo"), "bar"); - assert_string_equal(bc_trie_lookup(t, "baz"), "lol"); - assert_string_equal(bc_trie_lookup(t, "asd"), "qwe"); - bc_trie_free(t); + assert_int_equal(sb_trie_size(t), 3); + assert_string_equal(sb_trie_lookup(t, "foo"), "bar"); + assert_string_equal(sb_trie_lookup(t, "baz"), "lol"); + assert_string_equal(sb_trie_lookup(t, "asd"), "qwe"); + sb_trie_free(t); } diff --git a/tests/blogc-make/check_settings.c b/tests/blogc-make/check_settings.c index 6eaaaec..a5940bb 100644 --- a/tests/blogc-make/check_settings.c +++ b/tests/blogc-make/check_settings.c @@ -13,24 +13,24 @@ #include #include +#include +#include "../../src/blogc-make/error.h" #include "../../src/blogc-make/settings.h" -#include "../../src/common/error.h" -#include "../../src/common/utils.h" static void test_settings_empty(void **state) { const char *a = ""; - bc_error_t *err = NULL; + sb_error_t *err = NULL; bm_settings_t *s = bm_settings_parse(a, strlen(a), &err); assert_non_null(err); assert_null(s); - assert_int_equal(err->type, BLOGC_MAKE_ERROR_SETTINGS); + assert_int_equal(err->code, BLOGC_MAKE_ERROR_SETTINGS); assert_string_equal(err->msg, "[global] key required but not found or empty: AUTHOR_NAME"); - bc_error_free(err); + sb_error_free(err); } @@ -45,14 +45,14 @@ test_settings(void **state) "[global]\n" "BOLA = asd\n" "GUDA = qwe\n"; - bc_error_t *err = NULL; + sb_error_t *err = NULL; bm_settings_t *s = bm_settings_parse(a, strlen(a), &err); assert_non_null(err); assert_null(s); - assert_int_equal(err->type, BLOGC_MAKE_ERROR_SETTINGS); + assert_int_equal(err->code, BLOGC_MAKE_ERROR_SETTINGS); assert_string_equal(err->msg, "[global] key required but not found or empty: AUTHOR_NAME"); - bc_error_free(err); + sb_error_free(err); } @@ -67,14 +67,14 @@ test_settings_env(void **state) "[environment]\n" "BOLA = asd\n" "GUDA = qwe\n"; - bc_error_t *err = NULL; + sb_error_t *err = NULL; bm_settings_t *s = bm_settings_parse(a, strlen(a), &err); assert_non_null(err); assert_null(s); - assert_int_equal(err->type, BLOGC_MAKE_ERROR_SETTINGS); + assert_int_equal(err->code, BLOGC_MAKE_ERROR_SETTINGS); assert_string_equal(err->msg, "[environment] key required but not found or empty: AUTHOR_NAME"); - bc_error_free(err); + sb_error_free(err); } @@ -113,36 +113,36 @@ test_settings2(void **state) "jjjj\n" "kkkk\n" "llll\n"; - bc_error_t *err = NULL; + sb_error_t *err = NULL; bm_settings_t *s = bm_settings_parse(a, strlen(a), &err); assert_null(err); assert_non_null(s); assert_null(s->root_dir); - assert_int_equal(bc_trie_size(s->global), 7); - assert_string_equal(bc_trie_lookup(s->global, "BOLA"), "asd"); - assert_string_equal(bc_trie_lookup(s->global, "GUDA"), "qwe"); - assert_string_equal(bc_trie_lookup(s->global, "AUTHOR_NAME"), "chunda"); - assert_string_equal(bc_trie_lookup(s->global, "AUTHOR_EMAIL"), "chunda@example.com"); - assert_string_equal(bc_trie_lookup(s->global, "SITE_TITLE"), "Fuuuuuuuuu"); - assert_string_equal(bc_trie_lookup(s->global, "SITE_TAGLINE"), "My cool tagline"); - assert_string_equal(bc_trie_lookup(s->global, "BASE_DOMAIN"), "http://example.com"); - assert_int_equal(bc_trie_size(s->settings), 15); - assert_string_equal(bc_trie_lookup(s->settings, "source_ext"), ".txt"); - assert_string_equal(bc_trie_lookup(s->settings, "html_ext"), "/index.html"); - assert_string_equal(bc_trie_lookup(s->settings, "content_dir"), "guda"); - assert_string_equal(bc_trie_lookup(s->settings, "template_dir"), "templates"); - assert_string_equal(bc_trie_lookup(s->settings, "main_template"), "foo.tmpl"); - assert_string_equal(bc_trie_lookup(s->settings, "date_format"), + assert_int_equal(sb_trie_size(s->global), 7); + assert_string_equal(sb_trie_lookup(s->global, "BOLA"), "asd"); + assert_string_equal(sb_trie_lookup(s->global, "GUDA"), "qwe"); + assert_string_equal(sb_trie_lookup(s->global, "AUTHOR_NAME"), "chunda"); + assert_string_equal(sb_trie_lookup(s->global, "AUTHOR_EMAIL"), "chunda@example.com"); + assert_string_equal(sb_trie_lookup(s->global, "SITE_TITLE"), "Fuuuuuuuuu"); + assert_string_equal(sb_trie_lookup(s->global, "SITE_TAGLINE"), "My cool tagline"); + assert_string_equal(sb_trie_lookup(s->global, "BASE_DOMAIN"), "http://example.com"); + assert_int_equal(sb_trie_size(s->settings), 15); + assert_string_equal(sb_trie_lookup(s->settings, "source_ext"), ".txt"); + assert_string_equal(sb_trie_lookup(s->settings, "html_ext"), "/index.html"); + assert_string_equal(sb_trie_lookup(s->settings, "content_dir"), "guda"); + assert_string_equal(sb_trie_lookup(s->settings, "template_dir"), "templates"); + assert_string_equal(sb_trie_lookup(s->settings, "main_template"), "foo.tmpl"); + assert_string_equal(sb_trie_lookup(s->settings, "date_format"), "%b %d, %Y, %I:%M %p GMT"); - assert_string_equal(bc_trie_lookup(s->settings, "posts_per_page"), "10"); - assert_string_equal(bc_trie_lookup(s->settings, "atom_prefix"), "atom"); - assert_string_equal(bc_trie_lookup(s->settings, "atom_ext"), ".xml"); - assert_string_equal(bc_trie_lookup(s->settings, "atom_posts_per_page"), "10"); - assert_string_equal(bc_trie_lookup(s->settings, "pagination_prefix"), "page"); - assert_string_equal(bc_trie_lookup(s->settings, "post_prefix"), "post"); - assert_string_equal(bc_trie_lookup(s->settings, "tag_prefix"), "tag"); - assert_string_equal(bc_trie_lookup(s->settings, "html_order"), "DESC"); - assert_string_equal(bc_trie_lookup(s->settings, "atom_order"), "DESC"); + assert_string_equal(sb_trie_lookup(s->settings, "posts_per_page"), "10"); + assert_string_equal(sb_trie_lookup(s->settings, "atom_prefix"), "atom"); + assert_string_equal(sb_trie_lookup(s->settings, "atom_ext"), ".xml"); + assert_string_equal(sb_trie_lookup(s->settings, "atom_posts_per_page"), "10"); + assert_string_equal(sb_trie_lookup(s->settings, "pagination_prefix"), "page"); + assert_string_equal(sb_trie_lookup(s->settings, "post_prefix"), "post"); + assert_string_equal(sb_trie_lookup(s->settings, "tag_prefix"), "tag"); + assert_string_equal(sb_trie_lookup(s->settings, "html_order"), "DESC"); + assert_string_equal(sb_trie_lookup(s->settings, "atom_order"), "DESC"); assert_non_null(s->posts); assert_string_equal(s->posts[0], "aaaa"); assert_string_equal(s->posts[1], "bbbb"); @@ -202,36 +202,36 @@ test_settings_env2(void **state) "jjjj\n" "kkkk\n" "llll\n"; - bc_error_t *err = NULL; + sb_error_t *err = NULL; bm_settings_t *s = bm_settings_parse(a, strlen(a), &err); assert_null(err); assert_non_null(s); assert_null(s->root_dir); - assert_int_equal(bc_trie_size(s->global), 7); - assert_string_equal(bc_trie_lookup(s->global, "BOLA"), "asd"); - assert_string_equal(bc_trie_lookup(s->global, "GUDA"), "qwe"); - assert_string_equal(bc_trie_lookup(s->global, "AUTHOR_NAME"), "chunda"); - assert_string_equal(bc_trie_lookup(s->global, "AUTHOR_EMAIL"), "chunda@example.com"); - assert_string_equal(bc_trie_lookup(s->global, "SITE_TITLE"), "Fuuuuuuuuu"); - assert_string_equal(bc_trie_lookup(s->global, "SITE_TAGLINE"), "My cool tagline"); - assert_string_equal(bc_trie_lookup(s->global, "BASE_DOMAIN"), "http://example.com"); - assert_int_equal(bc_trie_size(s->settings), 15); - assert_string_equal(bc_trie_lookup(s->settings, "source_ext"), ".txt"); - assert_string_equal(bc_trie_lookup(s->settings, "html_ext"), "/index.html"); - assert_string_equal(bc_trie_lookup(s->settings, "content_dir"), "guda"); - assert_string_equal(bc_trie_lookup(s->settings, "template_dir"), "templates"); - assert_string_equal(bc_trie_lookup(s->settings, "main_template"), "foo.tmpl"); - assert_string_equal(bc_trie_lookup(s->settings, "date_format"), + assert_int_equal(sb_trie_size(s->global), 7); + assert_string_equal(sb_trie_lookup(s->global, "BOLA"), "asd"); + assert_string_equal(sb_trie_lookup(s->global, "GUDA"), "qwe"); + assert_string_equal(sb_trie_lookup(s->global, "AUTHOR_NAME"), "chunda"); + assert_string_equal(sb_trie_lookup(s->global, "AUTHOR_EMAIL"), "chunda@example.com"); + assert_string_equal(sb_trie_lookup(s->global, "SITE_TITLE"), "Fuuuuuuuuu"); + assert_string_equal(sb_trie_lookup(s->global, "SITE_TAGLINE"), "My cool tagline"); + assert_string_equal(sb_trie_lookup(s->global, "BASE_DOMAIN"), "http://example.com"); + assert_int_equal(sb_trie_size(s->settings), 15); + assert_string_equal(sb_trie_lookup(s->settings, "source_ext"), ".txt"); + assert_string_equal(sb_trie_lookup(s->settings, "html_ext"), "/index.html"); + assert_string_equal(sb_trie_lookup(s->settings, "content_dir"), "guda"); + assert_string_equal(sb_trie_lookup(s->settings, "template_dir"), "templates"); + assert_string_equal(sb_trie_lookup(s->settings, "main_template"), "foo.tmpl"); + assert_string_equal(sb_trie_lookup(s->settings, "date_format"), "%b %d, %Y, %I:%M %p GMT"); - assert_string_equal(bc_trie_lookup(s->settings, "posts_per_page"), "10"); - assert_string_equal(bc_trie_lookup(s->settings, "atom_prefix"), "atom"); - assert_string_equal(bc_trie_lookup(s->settings, "atom_ext"), ".xml"); - assert_string_equal(bc_trie_lookup(s->settings, "atom_posts_per_page"), "10"); - assert_string_equal(bc_trie_lookup(s->settings, "pagination_prefix"), "page"); - assert_string_equal(bc_trie_lookup(s->settings, "post_prefix"), "post"); - assert_string_equal(bc_trie_lookup(s->settings, "tag_prefix"), "tag"); - assert_string_equal(bc_trie_lookup(s->settings, "html_order"), "DESC"); - assert_string_equal(bc_trie_lookup(s->settings, "atom_order"), "DESC"); + assert_string_equal(sb_trie_lookup(s->settings, "posts_per_page"), "10"); + assert_string_equal(sb_trie_lookup(s->settings, "atom_prefix"), "atom"); + assert_string_equal(sb_trie_lookup(s->settings, "atom_ext"), ".xml"); + assert_string_equal(sb_trie_lookup(s->settings, "atom_posts_per_page"), "10"); + assert_string_equal(sb_trie_lookup(s->settings, "pagination_prefix"), "page"); + assert_string_equal(sb_trie_lookup(s->settings, "post_prefix"), "post"); + assert_string_equal(sb_trie_lookup(s->settings, "tag_prefix"), "tag"); + assert_string_equal(sb_trie_lookup(s->settings, "html_order"), "DESC"); + assert_string_equal(sb_trie_lookup(s->settings, "atom_order"), "DESC"); assert_non_null(s->posts); assert_string_equal(s->posts[0], "aaaa"); assert_string_equal(s->posts[1], "bbbb"); @@ -291,36 +291,36 @@ test_settings_copy_files(void **state) "jjjj\n" "kkkk\n" "llll\n"; - bc_error_t *err = NULL; + sb_error_t *err = NULL; bm_settings_t *s = bm_settings_parse(a, strlen(a), &err); assert_null(err); assert_non_null(s); assert_null(s->root_dir); - assert_int_equal(bc_trie_size(s->global), 7); - assert_string_equal(bc_trie_lookup(s->global, "BOLA"), "asd"); - assert_string_equal(bc_trie_lookup(s->global, "GUDA"), "qwe"); - assert_string_equal(bc_trie_lookup(s->global, "AUTHOR_NAME"), "chunda"); - assert_string_equal(bc_trie_lookup(s->global, "AUTHOR_EMAIL"), "chunda@example.com"); - assert_string_equal(bc_trie_lookup(s->global, "SITE_TITLE"), "Fuuuuuuuuu"); - assert_string_equal(bc_trie_lookup(s->global, "SITE_TAGLINE"), "My cool tagline"); - assert_string_equal(bc_trie_lookup(s->global, "BASE_DOMAIN"), "http://example.com"); - assert_int_equal(bc_trie_size(s->settings), 15); - assert_string_equal(bc_trie_lookup(s->settings, "source_ext"), ".txt"); - assert_string_equal(bc_trie_lookup(s->settings, "html_ext"), "/index.html"); - assert_string_equal(bc_trie_lookup(s->settings, "content_dir"), "guda"); - assert_string_equal(bc_trie_lookup(s->settings, "template_dir"), "templates"); - assert_string_equal(bc_trie_lookup(s->settings, "main_template"), "foo.tmpl"); - assert_string_equal(bc_trie_lookup(s->settings, "date_format"), + assert_int_equal(sb_trie_size(s->global), 7); + assert_string_equal(sb_trie_lookup(s->global, "BOLA"), "asd"); + assert_string_equal(sb_trie_lookup(s->global, "GUDA"), "qwe"); + assert_string_equal(sb_trie_lookup(s->global, "AUTHOR_NAME"), "chunda"); + assert_string_equal(sb_trie_lookup(s->global, "AUTHOR_EMAIL"), "chunda@example.com"); + assert_string_equal(sb_trie_lookup(s->global, "SITE_TITLE"), "Fuuuuuuuuu"); + assert_string_equal(sb_trie_lookup(s->global, "SITE_TAGLINE"), "My cool tagline"); + assert_string_equal(sb_trie_lookup(s->global, "BASE_DOMAIN"), "http://example.com"); + assert_int_equal(sb_trie_size(s->settings), 15); + assert_string_equal(sb_trie_lookup(s->settings, "source_ext"), ".txt"); + assert_string_equal(sb_trie_lookup(s->settings, "html_ext"), "/index.html"); + assert_string_equal(sb_trie_lookup(s->settings, "content_dir"), "guda"); + assert_string_equal(sb_trie_lookup(s->settings, "template_dir"), "templates"); + assert_string_equal(sb_trie_lookup(s->settings, "main_template"), "foo.tmpl"); + assert_string_equal(sb_trie_lookup(s->settings, "date_format"), "%b %d, %Y, %I:%M %p GMT"); - assert_string_equal(bc_trie_lookup(s->settings, "posts_per_page"), "10"); - assert_string_equal(bc_trie_lookup(s->settings, "atom_prefix"), "atom"); - assert_string_equal(bc_trie_lookup(s->settings, "atom_ext"), ".xml"); - assert_string_equal(bc_trie_lookup(s->settings, "atom_posts_per_page"), "10"); - assert_string_equal(bc_trie_lookup(s->settings, "pagination_prefix"), "page"); - assert_string_equal(bc_trie_lookup(s->settings, "post_prefix"), "post"); - assert_string_equal(bc_trie_lookup(s->settings, "tag_prefix"), "tag"); - assert_string_equal(bc_trie_lookup(s->settings, "html_order"), "DESC"); - assert_string_equal(bc_trie_lookup(s->settings, "atom_order"), "DESC"); + assert_string_equal(sb_trie_lookup(s->settings, "posts_per_page"), "10"); + assert_string_equal(sb_trie_lookup(s->settings, "atom_prefix"), "atom"); + assert_string_equal(sb_trie_lookup(s->settings, "atom_ext"), ".xml"); + assert_string_equal(sb_trie_lookup(s->settings, "atom_posts_per_page"), "10"); + assert_string_equal(sb_trie_lookup(s->settings, "pagination_prefix"), "page"); + assert_string_equal(sb_trie_lookup(s->settings, "post_prefix"), "post"); + assert_string_equal(sb_trie_lookup(s->settings, "tag_prefix"), "tag"); + assert_string_equal(sb_trie_lookup(s->settings, "html_order"), "DESC"); + assert_string_equal(sb_trie_lookup(s->settings, "atom_order"), "DESC"); assert_non_null(s->posts); assert_string_equal(s->posts[0], "aaaa"); assert_string_equal(s->posts[1], "bbbb"); -- cgit v1.2.3-18-g5258