From 7603c543e8015ca6924841e8d523759478614b28 Mon Sep 17 00:00:00 2001 From: dhgbayne Date: Thu, 30 Jun 2011 23:06:22 +0000 Subject: [PATCH] Array tests, plus fixed potential segfault in use of function pointer. --- src/seatest.h | 2 +- tests/seatest_tests.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/seatest.h b/src/seatest.h index 8608026..973dc75 100644 --- a/src/seatest.h +++ b/src/seatest.h @@ -20,7 +20,7 @@ typedef void (*seatest_void_string)(char*); /* Declarations */ - +void (*seatest_simple_test_result)(int passed, char* reason, const char* function, unsigned int line); void seatest_test_fixture_start(char* filepath); void seatest_test_fixture_end( void ); void seatest_simple_test_result_log(int passed, char* reason, const char* function, unsigned int line); diff --git a/tests/seatest_tests.c b/tests/seatest_tests.c index ecdb819..85a167b 100644 --- a/tests/seatest_tests.c +++ b/tests/seatest_tests.c @@ -1,5 +1,18 @@ #include "seatest_tests.h" +void test_assert_n_array_equal() +{ + int array_1[4] = { 0, 1, 2, 3 }; + int array_2[4] = { 0, 1, 2, 4 }; + int array_3[4] = { 0, 1, 2, 3 }; + + assert_test_passes(assert_n_array_equal(array_1, array_1, 4)); + assert_test_passes(assert_n_array_equal(array_1, array_3, 4)); + assert_test_passes(assert_n_array_equal(array_1, array_2, 3)); + assert_test_fails(assert_n_array_equal(array_1, array_2, 4)); + assert_test_fails(assert_n_array_equal(array_1, array_2, 0)); +} + void test_assert_string_equal() { assert_test_passes(assert_string_equal((char *)0, (char *)0)); @@ -48,6 +61,7 @@ void test_fixture_seatest(void) run_test(test_assert_int_equal); run_test(test_assert_ulong_equal); run_test(test_assert_string_equal); + run_test(test_assert_n_array_equal); test_fixture_end(); }