aboutsummaryrefslogtreecommitdiffstats
path: root/tests/blogc/check_source_parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/blogc/check_source_parser.c')
-rw-r--r--tests/blogc/check_source_parser.c166
1 files changed, 83 insertions, 83 deletions
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);
}