aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2015-10-24 19:10:42 -0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2015-10-24 19:10:42 -0200
commitb27251f29dbf35b2580df0586779bc3366cf2dad (patch)
tree132c9a4a7880f64d3552a3481c77a9a9f0323f86 /tests
parent7127defbaa3701fc3444feb3233401e2829fc1b6 (diff)
downloadblogc-b27251f29dbf35b2580df0586779bc3366cf2dad.tar.gz
blogc-b27251f29dbf35b2580df0586779bc3366cf2dad.tar.bz2
blogc-b27251f29dbf35b2580df0586779bc3366cf2dad.zip
datetime-parser: fixed strptime error handling
Diffstat (limited to 'tests')
-rw-r--r--tests/check_datetime_parser.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/check_datetime_parser.c b/tests/check_datetime_parser.c
index 37deb02..1997678 100644
--- a/tests/check_datetime_parser.c
+++ b/tests/check_datetime_parser.c
@@ -591,6 +591,50 @@ test_convert_datetime_invalid_seconds(void **state)
}
+static void
+test_convert_datetime_invalid_format_long(void **state)
+{
+ blogc_error_t *err = NULL;
+ char *dt = blogc_convert_datetime("2010-12-30 12:13:14",
+ "bovhsuhxwybfrxoluiejaoqpmoylgvkrjtnuntmcgtupwabexkapnklvkwmddmplfqopvb"
+ "yjsiimtfdeveeeayqvvnthimbqotumngxxenurxhsvyaftwsfdtxqnjluvtcwfkomfffrk"
+ "tywccrvnraagtnedwdjtfobinobbymanppwqxubxeepotdyxuvircyshpmtrqyvbivtycs"
+ "olwvqwdqaswdafohqkthraenpueuywbocrsbmmfoqwgbeixosyjljamcqwecfoxgolyxif"
+ "ltaoamuirnnsvoqcnboueqnnyksawwrdtcsiklanjxeavlaqsaswacmbvmselsnghiviet"
+ "wrftrfimjshrjlwxdhjkktivwmmesihlxkmqpmvfqjuimbmaucdxaqcgjdacgksqdseqko"
+ "prknyjylchdlijfgktveldlewixwrycytrjxxesrcbraydmbgitkldbxxhnjwqdmcwctat"
+ "rtjvrboulykkpvmsthontrunvkylwanwnnbpgwiwrgctfsvfgtxpifmpxhwikcylfeycjl"
+ "scmsjnvwfhlkwevcmvvoypmfqlnrwywkwvinkwbjpgxpdxfckghutcovrdhlatumhfvowb"
+ "fyiowyqpsbqhdxxauflpteyagsjtbulpktxmhkxxbgpetlwnckwsvhgmtasviemjeatejs"
+ "tslaivqeltycdgqylhqadxnrdlldbqdwuabdsrqwlxmetahvkrlvmyfgfftrlujfgktwve"
+ "vwidoqvigelfaohgjtaplygmmiwrcspaqntfhthikewunxhebqbkwiopplcmywvjeehslw"
+ "uaeruwnphdjonqagjatjladqhvlxppyaqgvwpjqggnsccmkjvbxqykaejvgeajqpitkwsq"
+ "gmjiaopomnnlewidhgbgqlblotrnuyokspuvbckqhwnhmgcwyyitmlelnehdvclojvyswj"
+ "jgipsincitulscikxviaruryfraeqssykeftcphtndlfhdxokg", &err);
+ assert_null(dt);
+ assert_non_null(err);
+ assert_int_equal(err->type, BLOGC_ERROR_DATETIME_PARSER);
+ assert_string_equal(err->msg,
+ "Failed to format DATE variable, FORMAT is too long: "
+ "bovhsuhxwybfrxoluiejaoqpmoylgvkrjtnuntmcgtupwabexkapnklvkwmddmplfqopvb"
+ "yjsiimtfdeveeeayqvvnthimbqotumngxxenurxhsvyaftwsfdtxqnjluvtcwfkomfffrk"
+ "tywccrvnraagtnedwdjtfobinobbymanppwqxubxeepotdyxuvircyshpmtrqyvbivtycs"
+ "olwvqwdqaswdafohqkthraenpueuywbocrsbmmfoqwgbeixosyjljamcqwecfoxgolyxif"
+ "ltaoamuirnnsvoqcnboueqnnyksawwrdtcsiklanjxeavlaqsaswacmbvmselsnghiviet"
+ "wrftrfimjshrjlwxdhjkktivwmmesihlxkmqpmvfqjuimbmaucdxaqcgjdacgksqdseqko"
+ "prknyjylchdlijfgktveldlewixwrycytrjxxesrcbraydmbgitkldbxxhnjwqdmcwctat"
+ "rtjvrboulykkpvmsthontrunvkylwanwnnbpgwiwrgctfsvfgtxpifmpxhwikcylfeycjl"
+ "scmsjnvwfhlkwevcmvvoypmfqlnrwywkwvinkwbjpgxpdxfckghutcovrdhlatumhfvowb"
+ "fyiowyqpsbqhdxxauflpteyagsjtbulpktxmhkxxbgpetlwnckwsvhgmtasviemjeatejs"
+ "tslaivqeltycdgqylhqadxnrdlldbqdwuabdsrqwlxmetahvkrlvmyfgfftrlujfgktwve"
+ "vwidoqvigelfaohgjtaplygmmiwrcspaqntfhthikewunxhebqbkwiopplcmywvjeehslw"
+ "uaeruwnphdjonqagjatjladqhvlxppyaqgvwpjqggnsccmkjvbxqykaejvgeajqpitkwsq"
+ "gmjiaopomnnlewidhgbgqlblotrnuyokspuvbckqhwnhmgcwyyitmlelnehdvclojvyswj"
+ "jgipsincitulscikxviaruryfraeqssykeftcphtndlfhdxokg");
+ blogc_error_free(err);
+}
+
+
int
main(void)
{
@@ -626,6 +670,7 @@ main(void)
unit_test(test_convert_datetime_invalid_1st_seconds),
unit_test(test_convert_datetime_invalid_2nd_seconds),
unit_test(test_convert_datetime_invalid_seconds),
+ unit_test(test_convert_datetime_invalid_format_long),
};
return run_tests(tests);
}