aboutsummaryrefslogtreecommitdiffstats
path: root/tests/check_datetime_parser.c
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2016-04-27 01:31:02 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2016-04-27 01:31:02 +0200
commit6153580a13e7e7c48e38fa446572c8adcae08084 (patch)
tree9be08616aed124c67159bf71fccd3a286bc0fe81 /tests/check_datetime_parser.c
parentc5e4f4c2d29831151bdce1802787b9cf012c3e5e (diff)
downloadblogc-6153580a13e7e7c48e38fa446572c8adcae08084.tar.gz
blogc-6153580a13e7e7c48e38fa446572c8adcae08084.tar.bz2
blogc-6153580a13e7e7c48e38fa446572c8adcae08084.zip
Revert "*: use squareball error infrastructure"
This reverts commit a2b3551dfb9460470bd79f5648bf597c517c40d4.
Diffstat (limited to 'tests/check_datetime_parser.c')
-rw-r--r--tests/check_datetime_parser.c216
1 files changed, 108 insertions, 108 deletions
diff --git a/tests/check_datetime_parser.c b/tests/check_datetime_parser.c
index aef366e..ba5a79d 100644
--- a/tests/check_datetime_parser.c
+++ b/tests/check_datetime_parser.c
@@ -24,7 +24,7 @@
static void
test_convert_datetime(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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)
{
- sb_error_t *err = NULL;
+ blogc_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)
{
- sb_error_t *err = NULL;
+ blogc_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)
{
- sb_error_t *err = NULL;
+ blogc_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)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_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 "
"'yyyy-mm-dd'.");
- sb_error_free(err);
+ blogc_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->code, BLOGC_WARNING_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 "
"'yyyy-mm-dd'.");
- sb_error_free(err);
+ blogc_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->code, BLOGC_WARNING_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 "
"'yyyy-mm-dd'.");
- sb_error_free(err);
+ blogc_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->code, BLOGC_WARNING_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 "
"'yyyy-mm-dd'.");
- sb_error_free(err);
+ blogc_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->code, BLOGC_WARNING_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 "
"'yyyy-mm-dd'.");
- sb_error_free(err);
+ blogc_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->code, BLOGC_WARNING_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 "
"'yyyy-mm-dd'.");
- sb_error_free(err);
+ blogc_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->code, BLOGC_WARNING_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 "
"'yyyy-mm-dd'.");
- sb_error_free(err);
+ blogc_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->code, BLOGC_WARNING_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 "
"'yyyy-mm-dd'.");
- sb_error_free(err);
+ blogc_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->code, BLOGC_WARNING_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 "
"'yyyy-mm-dd'.");
- sb_error_free(err);
+ blogc_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->code, BLOGC_WARNING_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 "
"'yyyy-mm-dd'.");
- sb_error_free(err);
+ blogc_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->code, BLOGC_WARNING_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 "
"'yyyy-mm-dd'.");
- sb_error_free(err);
+ blogc_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->code, BLOGC_WARNING_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 "
"'yyyy-mm-dd'.");
- sb_error_free(err);
+ blogc_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->code, BLOGC_WARNING_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 "
"'yyyy-mm-dd'.");
- sb_error_free(err);
+ blogc_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->code, BLOGC_WARNING_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 "
"'yyyy-mm-dd'.");
- sb_error_free(err);
+ blogc_error_free(err);
}
static void
test_convert_datetime_invalid_1st_year(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_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.");
- sb_error_free(err);
+ blogc_error_free(err);
}
static void
test_convert_datetime_invalid_2nd_year(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_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.");
- sb_error_free(err);
+ blogc_error_free(err);
}
static void
test_convert_datetime_invalid_3rd_year(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_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.");
- sb_error_free(err);
+ blogc_error_free(err);
}
static void
test_convert_datetime_invalid_4th_year(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_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.");
- sb_error_free(err);
+ blogc_error_free(err);
}
static void
test_convert_datetime_invalid_year(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_DATETIME_PARSER);
+ assert_int_equal(err->type, BLOGC_WARNING_DATETIME_PARSER);
assert_string_equal(err->msg,
"Invalid year. Found 1899, must be >= 1900.");
- sb_error_free(err);
+ blogc_error_free(err);
}
static void
test_convert_datetime_invalid_1st_hyphen(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_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 '-'.");
- sb_error_free(err);
+ blogc_error_free(err);
}
static void
test_convert_datetime_invalid_1st_month(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_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.");
- sb_error_free(err);
+ blogc_error_free(err);
}
static void
test_convert_datetime_invalid_2nd_month(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_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.");
- sb_error_free(err);
+ blogc_error_free(err);
}
static void
test_convert_datetime_invalid_month(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_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.");
- sb_error_free(err);
+ blogc_error_free(err);
}
static void
test_convert_datetime_invalid_2nd_hyphen(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_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 '-'.");
- sb_error_free(err);
+ blogc_error_free(err);
}
static void
test_convert_datetime_invalid_1st_day(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_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.");
- sb_error_free(err);
+ blogc_error_free(err);
}
static void
test_convert_datetime_invalid_2nd_day(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_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.");
- sb_error_free(err);
+ blogc_error_free(err);
}
static void
test_convert_datetime_invalid_day(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_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.");
- sb_error_free(err);
+ blogc_error_free(err);
}
static void
test_convert_datetime_invalid_space(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_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).");
- sb_error_free(err);
+ blogc_error_free(err);
}
static void
test_convert_datetime_invalid_1st_hours(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_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.");
- sb_error_free(err);
+ blogc_error_free(err);
}
static void
test_convert_datetime_invalid_2nd_hours(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_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.");
- sb_error_free(err);
+ blogc_error_free(err);
}
static void
test_convert_datetime_invalid_hours(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_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.");
- sb_error_free(err);
+ blogc_error_free(err);
}
static void
test_convert_datetime_invalid_1st_colon(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_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 ':'.");
- sb_error_free(err);
+ blogc_error_free(err);
}
static void
test_convert_datetime_invalid_1st_minutes(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_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.");
- sb_error_free(err);
+ blogc_error_free(err);
}
static void
test_convert_datetime_invalid_2nd_minutes(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_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.");
- sb_error_free(err);
+ blogc_error_free(err);
}
static void
test_convert_datetime_invalid_2nd_colon(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_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 ':'.");
- sb_error_free(err);
+ blogc_error_free(err);
}
static void
test_convert_datetime_invalid_1st_seconds(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_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.");
- sb_error_free(err);
+ blogc_error_free(err);
}
static void
test_convert_datetime_invalid_2nd_seconds(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_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.");
- sb_error_free(err);
+ blogc_error_free(err);
}
static void
test_convert_datetime_invalid_seconds(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_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.");
- sb_error_free(err);
+ blogc_error_free(err);
}
static void
test_convert_datetime_invalid_format_long(void **state)
{
- sb_error_t *err = NULL;
+ blogc_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->code, BLOGC_WARNING_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"
@@ -631,7 +631,7 @@ test_convert_datetime_invalid_format_long(void **state)
"uaeruwnphdjonqagjatjladqhvlxppyaqgvwpjqggnsccmkjvbxqykaejvgeajqpitkwsq"
"gmjiaopomnnlewidhgbgqlblotrnuyokspuvbckqhwnhmgcwyyitmlelnehdvclojvyswj"
"jgipsincitulscikxviaruryfraeqssykeftcphtndlfhdxokg");
- sb_error_free(err);
+ blogc_error_free(err);
}