diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2014-09-12 17:18:57 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2015-02-08 10:29:16 +0100 |
commit | 5e8c5d90db2c55e203c11dbbec91c3e44bcb2023 (patch) | |
tree | 81d89f4749a9e51a26912502317ffc32fac9190f /tests/test_basics.c | |
parent | 05c73e1d3d7693b2ff0f1a5f8c39a6e32c7a2f38 (diff) | |
download | cmocka-5e8c5d90db2c55e203c11dbbec91c3e44bcb2023.tar.gz cmocka-5e8c5d90db2c55e203c11dbbec91c3e44bcb2023.tar.xz cmocka-5e8c5d90db2c55e203c11dbbec91c3e44bcb2023.zip |
tests: Use new cmocka test runner in our tests and examples
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'tests/test_basics.c')
-rw-r--r-- | tests/test_basics.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/test_basics.c b/tests/test_basics.c index 63fc27b..1bb493f 100644 --- a/tests/test_basics.c +++ b/tests/test_basics.c @@ -22,17 +22,21 @@ #include <setjmp.h> #include <cmocka.h> -static void setup(void **state) { +static int setup(void **state) { int *answer = malloc(sizeof(int)); assert_non_null(answer); *answer = 42; *state = answer; + + return 0; } -static void teardown(void **state) { +static int teardown(void **state) { free(*state); + + return 0; } /* A test case that does nothing and succeeds. */ @@ -49,10 +53,10 @@ static void int_test_success(void **state) { int main(void) { - const UnitTest tests[] = { - unit_test(null_test_success), - unit_test_setup_teardown(int_test_success, setup, teardown), + const struct CMUnitTest tests[] = { + cmocka_unit_test(null_test_success), + cmocka_unit_test_setup_teardown(int_test_success, setup, teardown), }; - return run_tests(tests); + return cmocka_run_group_tests(tests, NULL, NULL); } |