diff options
Diffstat (limited to 'tests/check_datetime_parser.c')
-rw-r--r-- | tests/check_datetime_parser.c | 216 |
1 files changed, 108 insertions, 108 deletions
diff --git a/tests/check_datetime_parser.c b/tests/check_datetime_parser.c index ba5a79d..aef366e 100644 --- a/tests/check_datetime_parser.c +++ b/tests/check_datetime_parser.c @@ -24,7 +24,7 @@ static void test_convert_datetime(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("2010-11-30 12:13:14", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(err); @@ -36,7 +36,7 @@ test_convert_datetime(void **state) static void test_convert_datetime_implicit_seconds(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("2010-11-30 12:13", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(err); @@ -48,7 +48,7 @@ test_convert_datetime_implicit_seconds(void **state) static void test_convert_datetime_implicit_minutes(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("2010-11-30 12", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(err); @@ -60,7 +60,7 @@ test_convert_datetime_implicit_minutes(void **state) static void test_convert_datetime_implicit_hours(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("2010-11-30", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(err); @@ -72,529 +72,529 @@ test_convert_datetime_implicit_hours(void **state) static void test_convert_datetime_invalid_formats(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid datetime string. Found '', formats allowed are: " "'yyyy-mm-dd hh:mm:ss', 'yyyy-mm-dd hh:ss', 'yyyy-mm-dd hh' and " "'yyyy-mm-dd'."); - blogc_error_free(err); + sb_error_free(err); err = NULL; dt = blogc_convert_datetime("2", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid datetime string. Found '2', formats allowed are: " "'yyyy-mm-dd hh:mm:ss', 'yyyy-mm-dd hh:ss', 'yyyy-mm-dd hh' and " "'yyyy-mm-dd'."); - blogc_error_free(err); + sb_error_free(err); err = NULL; dt = blogc_convert_datetime("20", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid datetime string. Found '20', formats allowed are: " "'yyyy-mm-dd hh:mm:ss', 'yyyy-mm-dd hh:ss', 'yyyy-mm-dd hh' and " "'yyyy-mm-dd'."); - blogc_error_free(err); + sb_error_free(err); err = NULL; dt = blogc_convert_datetime("201", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid datetime string. Found '201', formats allowed are: " "'yyyy-mm-dd hh:mm:ss', 'yyyy-mm-dd hh:ss', 'yyyy-mm-dd hh' and " "'yyyy-mm-dd'."); - blogc_error_free(err); + sb_error_free(err); err = NULL; dt = blogc_convert_datetime("2010", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid datetime string. Found '2010', formats allowed are: " "'yyyy-mm-dd hh:mm:ss', 'yyyy-mm-dd hh:ss', 'yyyy-mm-dd hh' and " "'yyyy-mm-dd'."); - blogc_error_free(err); + sb_error_free(err); err = NULL; dt = blogc_convert_datetime("2010-", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid datetime string. Found '2010-', formats allowed are: " "'yyyy-mm-dd hh:mm:ss', 'yyyy-mm-dd hh:ss', 'yyyy-mm-dd hh' and " "'yyyy-mm-dd'."); - blogc_error_free(err); + sb_error_free(err); err = NULL; dt = blogc_convert_datetime("2010-1", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid datetime string. Found '2010-1', formats allowed are: " "'yyyy-mm-dd hh:mm:ss', 'yyyy-mm-dd hh:ss', 'yyyy-mm-dd hh' and " "'yyyy-mm-dd'."); - blogc_error_free(err); + sb_error_free(err); err = NULL; dt = blogc_convert_datetime("2010-11", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid datetime string. Found '2010-11', formats allowed are: " "'yyyy-mm-dd hh:mm:ss', 'yyyy-mm-dd hh:ss', 'yyyy-mm-dd hh' and " "'yyyy-mm-dd'."); - blogc_error_free(err); + sb_error_free(err); err = NULL; dt = blogc_convert_datetime("2010-11-", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid datetime string. Found '2010-11-', formats allowed are: " "'yyyy-mm-dd hh:mm:ss', 'yyyy-mm-dd hh:ss', 'yyyy-mm-dd hh' and " "'yyyy-mm-dd'."); - blogc_error_free(err); + sb_error_free(err); err = NULL; dt = blogc_convert_datetime("2010-11-3", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid datetime string. Found '2010-11-3', formats allowed are: " "'yyyy-mm-dd hh:mm:ss', 'yyyy-mm-dd hh:ss', 'yyyy-mm-dd hh' and " "'yyyy-mm-dd'."); - blogc_error_free(err); + sb_error_free(err); err = NULL; dt = blogc_convert_datetime("2010-11-30 ", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid datetime string. Found '2010-11-30 ', formats allowed are: " "'yyyy-mm-dd hh:mm:ss', 'yyyy-mm-dd hh:ss', 'yyyy-mm-dd hh' and " "'yyyy-mm-dd'."); - blogc_error_free(err); + sb_error_free(err); err = NULL; dt = blogc_convert_datetime("2010-11-30 1", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid datetime string. Found '2010-11-30 1', formats allowed are: " "'yyyy-mm-dd hh:mm:ss', 'yyyy-mm-dd hh:ss', 'yyyy-mm-dd hh' and " "'yyyy-mm-dd'."); - blogc_error_free(err); + sb_error_free(err); err = NULL; dt = blogc_convert_datetime("2010-11-30 12:1", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid datetime string. Found '2010-11-30 12:1', formats allowed are: " "'yyyy-mm-dd hh:mm:ss', 'yyyy-mm-dd hh:ss', 'yyyy-mm-dd hh' and " "'yyyy-mm-dd'."); - blogc_error_free(err); + sb_error_free(err); err = NULL; dt = blogc_convert_datetime("2010-11-30 12:13:1", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid datetime string. Found '2010-11-30 12:13:1', formats allowed are: " "'yyyy-mm-dd hh:mm:ss', 'yyyy-mm-dd hh:ss', 'yyyy-mm-dd hh' and " "'yyyy-mm-dd'."); - blogc_error_free(err); + sb_error_free(err); } static void test_convert_datetime_invalid_1st_year(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("a010-11-30 12:13:14", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid first digit of year. Found 'a', must be integer >= 0 and <= 9."); - blogc_error_free(err); + sb_error_free(err); } static void test_convert_datetime_invalid_2nd_year(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("2a10-11-30 12:13:14", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid second digit of year. Found 'a', must be integer >= 0 and <= 9."); - blogc_error_free(err); + sb_error_free(err); } static void test_convert_datetime_invalid_3rd_year(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("20a0-11-30 12:13:14", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid third digit of year. Found 'a', must be integer >= 0 and <= 9."); - blogc_error_free(err); + sb_error_free(err); } static void test_convert_datetime_invalid_4th_year(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("201a-11-30 12:13:14", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid fourth digit of year. Found 'a', must be integer >= 0 and <= 9."); - blogc_error_free(err); + sb_error_free(err); } static void test_convert_datetime_invalid_year(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("1899-11-30 12:13:14", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid year. Found 1899, must be >= 1900."); - blogc_error_free(err); + sb_error_free(err); } static void test_convert_datetime_invalid_1st_hyphen(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("2010 11-30 12:13:14", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid separator between year and month. Found ' ', must be '-'."); - blogc_error_free(err); + sb_error_free(err); } static void test_convert_datetime_invalid_1st_month(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("2010-a1-30 12:13:14", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid first digit of month. Found 'a', must be integer >= 0 and <= 1."); - blogc_error_free(err); + sb_error_free(err); } static void test_convert_datetime_invalid_2nd_month(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("2010-1a-30 12:13:14", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid second digit of month. Found 'a', must be integer >= 0 and <= 9."); - blogc_error_free(err); + sb_error_free(err); } static void test_convert_datetime_invalid_month(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("2010-13-30 12:13:14", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid month. Found 13, must be >= 1 and <= 12."); - blogc_error_free(err); + sb_error_free(err); } static void test_convert_datetime_invalid_2nd_hyphen(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("2010-11 30 12:13:14", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid separator between month and day. Found ' ', must be '-'."); - blogc_error_free(err); + sb_error_free(err); } static void test_convert_datetime_invalid_1st_day(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("2010-11-a0 12:13:14", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid first digit of day. Found 'a', must be integer >= 0 and <= 3."); - blogc_error_free(err); + sb_error_free(err); } static void test_convert_datetime_invalid_2nd_day(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("2010-11-3a 12:13:14", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid second digit of day. Found 'a', must be integer >= 0 and <= 9."); - blogc_error_free(err); + sb_error_free(err); } static void test_convert_datetime_invalid_day(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("2010-12-32 12:13:14", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid day. Found 32, must be >= 1 and <= 31."); - blogc_error_free(err); + sb_error_free(err); } static void test_convert_datetime_invalid_space(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("2010-11-30-12:13:14", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid separator between date and time. Found '-', must be ' ' " "(empty space)."); - blogc_error_free(err); + sb_error_free(err); } static void test_convert_datetime_invalid_1st_hours(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("2010-11-30 a2:13:14", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid first digit of hours. Found 'a', must be integer >= 0 and <= 2."); - blogc_error_free(err); + sb_error_free(err); } static void test_convert_datetime_invalid_2nd_hours(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("2010-11-30 1a:13:14", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid second digit of hours. Found 'a', must be integer >= 0 and <= 9."); - blogc_error_free(err); + sb_error_free(err); } static void test_convert_datetime_invalid_hours(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("2010-12-30 24:13:14", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid hours. Found 24, must be >= 0 and <= 23."); - blogc_error_free(err); + sb_error_free(err); } static void test_convert_datetime_invalid_1st_colon(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("2010-11-30 12 13:14", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid separator between hours and minutes. Found ' ', must be ':'."); - blogc_error_free(err); + sb_error_free(err); } static void test_convert_datetime_invalid_1st_minutes(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("2010-11-30 12:a3:14", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid first digit of minutes. Found 'a', must be integer >= 0 and <= 5."); - blogc_error_free(err); + sb_error_free(err); } static void test_convert_datetime_invalid_2nd_minutes(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("2010-11-30 12:1a:14", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid second digit of minutes. Found 'a', must be integer >= 0 and <= 9."); - blogc_error_free(err); + sb_error_free(err); } static void test_convert_datetime_invalid_2nd_colon(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("2010-11-30 12:13 14", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid separator between minutes and seconds. Found ' ', must be ':'."); - blogc_error_free(err); + sb_error_free(err); } static void test_convert_datetime_invalid_1st_seconds(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("2010-11-30 12:13:a4", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid first digit of seconds. Found 'a', must be integer >= 0 and <= 6."); - blogc_error_free(err); + sb_error_free(err); } static void test_convert_datetime_invalid_2nd_seconds(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("2010-11-30 12:13:1a", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid second digit of seconds. Found 'a', must be integer >= 0 and <= 9."); - blogc_error_free(err); + sb_error_free(err); } static void test_convert_datetime_invalid_seconds(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("2010-12-30 12:13:69", "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid seconds. Found 69, must be >= 0 and <= 60."); - blogc_error_free(err); + sb_error_free(err); } static void test_convert_datetime_invalid_format_long(void **state) { - blogc_error_t *err = NULL; + sb_error_t *err = NULL; char *dt = blogc_convert_datetime("2010-12-30 12:13:14", "bovhsuhxwybfrxoluiejaoqpmoylgvkrjtnuntmcgtupwabexkapnklvkwmddmplfqopvb" "yjsiimtfdeveeeayqvvnthimbqotumngxxenurxhsvyaftwsfdtxqnjluvtcwfkomfffrk" @@ -613,7 +613,7 @@ test_convert_datetime_invalid_format_long(void **state) "jgipsincitulscikxviaruryfraeqssykeftcphtndlfhdxokg", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); + assert_int_equal(err->code, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Failed to format DATE variable, FORMAT is too long: " "bovhsuhxwybfrxoluiejaoqpmoylgvkrjtnuntmcgtupwabexkapnklvkwmddmplfqopvb" @@ -631,7 +631,7 @@ test_convert_datetime_invalid_format_long(void **state) "uaeruwnphdjonqagjatjladqhvlxppyaqgvwpjqggnsccmkjvbxqykaejvgeajqpitkwsq" "gmjiaopomnnlewidhgbgqlblotrnuyokspuvbckqhwnhmgcwyyitmlelnehdvclojvyswj" "jgipsincitulscikxviaruryfraeqssykeftcphtndlfhdxokg"); - blogc_error_free(err); + sb_error_free(err); } |