aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-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),
};