aboutsummaryrefslogtreecommitdiffstats
path: root/tests/check_error.c
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2016-04-27 01:30:49 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2016-04-27 01:30:49 +0200
commitc5e4f4c2d29831151bdce1802787b9cf012c3e5e (patch)
tree54d2d3af24babcfb1e20042445692cc818ce5431 /tests/check_error.c
parent25c2e03228e00f577fac4a52079c601010df4f15 (diff)
downloadblogc-c5e4f4c2d29831151bdce1802787b9cf012c3e5e.tar.gz
blogc-c5e4f4c2d29831151bdce1802787b9cf012c3e5e.tar.bz2
blogc-c5e4f4c2d29831151bdce1802787b9cf012c3e5e.zip
Revert "error: removed uneeded tests"
This reverts commit 37592b57b31987519e59117d49bccd0207e67f15.
Diffstat (limited to 'tests/check_error.c')
-rw-r--r--tests/check_error.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/check_error.c b/tests/check_error.c
index c990b45..7fc3c3e 100644
--- a/tests/check_error.c
+++ b/tests/check_error.c
@@ -20,6 +20,28 @@
static void
+test_error_new(void **state)
+{
+ sb_error_t *error = sb_error_new(1, "bola %s");
+ assert_non_null(error);
+ assert_int_equal(error->code, 1);
+ assert_string_equal(error->msg, "bola %s");
+ sb_error_free(error);
+}
+
+
+static void
+test_error_new_printf(void **state)
+{
+ sb_error_t *error = sb_error_new_printf(2, "bola %s", "guda");
+ assert_non_null(error);
+ assert_int_equal(error->code, 2);
+ assert_string_equal(error->msg, "bola guda");
+ sb_error_free(error);
+}
+
+
+static void
test_error_parser(void **state)
{
const char *a = "bola\nguda\nchunda\n";
@@ -83,6 +105,8 @@ int
main(void)
{
const UnitTest tests[] = {
+ unit_test(test_error_new),
+ unit_test(test_error_new_printf),
unit_test(test_error_parser),
unit_test(test_error_parser_crlf),
};