diff options
Diffstat (limited to 'test_util.c')
-rw-r--r-- | test_util.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/test_util.c b/test_util.c index 81c3db7..c6b9b83 100644 --- a/test_util.c +++ b/test_util.c @@ -1,14 +1,13 @@ #include <string.h> +#include "test_runner.h" #include "unity.h" #include "util.h" -void setUp(){}; -void tearDown(){}; /* blank_to_eol should pad a buffer with spaces as far as it can, after an * existing string therein, without overrunning, while still terminating */ -void test_blank_to_eol_happy(void) +RUNNER_DECLARE_TEST(test_blank_to_eol_happy) { char buf[11] = "hello"; blank_to_eol(buf, sizeof(buf)); @@ -17,7 +16,7 @@ void test_blank_to_eol_happy(void) /* blanking an empty string to end of buffer should fill entire buffer with * spaces until the last byte, which should be null terminator */ -void test_blank_to_eol_empty(void) +RUNNER_DECLARE_TEST(test_blank_to_eol_empty) { char buf[5] = ""; blank_to_eol(buf, sizeof(buf)); @@ -25,7 +24,7 @@ void test_blank_to_eol_empty(void) } /* blanking should not overrun the specified buffer size at all */ -void test_blank_to_eol_no_overrun(void) +RUNNER_DECLARE_TEST(test_blank_to_eol_no_overrun) { char buf[20] = { 'h', 'e', 'l', 'l', 'o', '\0', @@ -41,7 +40,7 @@ void test_blank_to_eol_no_overrun(void) /* blanking a buffer which already has no '\0' within it should result in the * buffer being terminated, truncating contents minimally as necessary to fit * a '\0' */ -void test_blank_to_eol_overrun(void) +RUNNER_DECLARE_TEST(test_blank_to_eol_overrun) { char buf[20] = "hello, world!"; blank_to_eol(buf, 6); @@ -50,13 +49,3 @@ void test_blank_to_eol_overrun(void) * doesn't test OOB reads, only writes */ TEST_ASSERT_EQUAL_STRING(" world!", &buf[6]); } - -int main(void) -{ - UNITY_BEGIN(); - RUN_TEST(test_blank_to_eol_happy); - RUN_TEST(test_blank_to_eol_empty); - RUN_TEST(test_blank_to_eol_no_overrun); - RUN_TEST(test_blank_to_eol_overrun); - return UNITY_END(); -} |