diff options
Diffstat (limited to 'tests/check_datetime_parser.c')
-rw-r--r-- | tests/check_datetime_parser.c | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/tests/check_datetime_parser.c b/tests/check_datetime_parser.c index 1997678..1ac976d 100644 --- a/tests/check_datetime_parser.c +++ b/tests/check_datetime_parser.c @@ -76,7 +76,7 @@ test_convert_datetime_invalid_formats(void **state) 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_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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 " @@ -87,7 +87,7 @@ test_convert_datetime_invalid_formats(void **state) 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_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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 " @@ -98,7 +98,7 @@ test_convert_datetime_invalid_formats(void **state) 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_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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 " @@ -109,7 +109,7 @@ test_convert_datetime_invalid_formats(void **state) 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_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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 " @@ -120,7 +120,7 @@ test_convert_datetime_invalid_formats(void **state) 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_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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 " @@ -131,7 +131,7 @@ test_convert_datetime_invalid_formats(void **state) 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_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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 " @@ -142,7 +142,7 @@ test_convert_datetime_invalid_formats(void **state) 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_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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 " @@ -153,7 +153,7 @@ test_convert_datetime_invalid_formats(void **state) 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_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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 " @@ -164,7 +164,7 @@ test_convert_datetime_invalid_formats(void **state) 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_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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 " @@ -175,7 +175,7 @@ test_convert_datetime_invalid_formats(void **state) 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_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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 " @@ -186,7 +186,7 @@ test_convert_datetime_invalid_formats(void **state) 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_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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 " @@ -197,7 +197,7 @@ test_convert_datetime_invalid_formats(void **state) 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_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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 " @@ -209,7 +209,7 @@ test_convert_datetime_invalid_formats(void **state) &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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 " @@ -221,7 +221,7 @@ test_convert_datetime_invalid_formats(void **state) &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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 " @@ -238,7 +238,7 @@ test_convert_datetime_invalid_1st_year(void **state) "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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); @@ -253,7 +253,7 @@ test_convert_datetime_invalid_2nd_year(void **state) "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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); @@ -268,7 +268,7 @@ test_convert_datetime_invalid_3rd_year(void **state) "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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); @@ -283,7 +283,7 @@ test_convert_datetime_invalid_4th_year(void **state) "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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); @@ -298,7 +298,7 @@ test_convert_datetime_invalid_year(void **state) "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid year. Found 1899, must be >= 1900."); blogc_error_free(err); @@ -313,7 +313,7 @@ test_convert_datetime_invalid_1st_hyphen(void **state) "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid separator between year and month. Found ' ', must be '-'."); blogc_error_free(err); @@ -328,7 +328,7 @@ test_convert_datetime_invalid_1st_month(void **state) "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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); @@ -343,7 +343,7 @@ test_convert_datetime_invalid_2nd_month(void **state) "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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); @@ -358,7 +358,7 @@ test_convert_datetime_invalid_month(void **state) "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid month. Found 13, must be >= 1 and <= 12."); blogc_error_free(err); @@ -373,7 +373,7 @@ test_convert_datetime_invalid_2nd_hyphen(void **state) "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid separator between month and day. Found ' ', must be '-'."); blogc_error_free(err); @@ -388,7 +388,7 @@ test_convert_datetime_invalid_1st_day(void **state) "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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); @@ -403,7 +403,7 @@ test_convert_datetime_invalid_2nd_day(void **state) "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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); @@ -418,7 +418,7 @@ test_convert_datetime_invalid_day(void **state) "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid day. Found 32, must be >= 1 and <= 31."); blogc_error_free(err); @@ -433,7 +433,7 @@ test_convert_datetime_invalid_space(void **state) "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid separator between date and time. Found '-', must be ' ' " "(empty space)."); @@ -449,7 +449,7 @@ test_convert_datetime_invalid_1st_hours(void **state) "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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); @@ -464,7 +464,7 @@ test_convert_datetime_invalid_2nd_hours(void **state) "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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); @@ -479,7 +479,7 @@ test_convert_datetime_invalid_hours(void **state) "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid hours. Found 24, must be >= 0 and <= 23."); blogc_error_free(err); @@ -494,7 +494,7 @@ test_convert_datetime_invalid_1st_colon(void **state) "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid separator between hours and minutes. Found ' ', must be ':'."); blogc_error_free(err); @@ -509,7 +509,7 @@ test_convert_datetime_invalid_1st_minutes(void **state) "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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); @@ -524,7 +524,7 @@ test_convert_datetime_invalid_2nd_minutes(void **state) "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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); @@ -539,7 +539,7 @@ test_convert_datetime_invalid_2nd_colon(void **state) "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid separator between minutes and seconds. Found ' ', must be ':'."); blogc_error_free(err); @@ -554,7 +554,7 @@ test_convert_datetime_invalid_1st_seconds(void **state) "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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); @@ -569,7 +569,7 @@ test_convert_datetime_invalid_2nd_seconds(void **state) "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, 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); @@ -584,7 +584,7 @@ test_convert_datetime_invalid_seconds(void **state) "%b %d, %Y, %I:%M:%S %p GMT", &err); assert_null(dt); assert_non_null(err); - assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Invalid seconds. Found 69, must be >= 0 and <= 60."); blogc_error_free(err); @@ -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_ERROR_DATETIME_PARSER); + assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER); assert_string_equal(err->msg, "Failed to format DATE variable, FORMAT is too long: " "bovhsuhxwybfrxoluiejaoqpmoylgvkrjtnuntmcgtupwabexkapnklvkwmddmplfqopvb" |