diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2016-02-10 12:00:36 +0100 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2016-02-10 12:00:36 +0100 |
commit | 9fc415a88f99b881b5c9f4c227c4967fd92d292a (patch) | |
tree | b9fcad26d9a84cea3db15e8db36221fd7f6d8462 | |
parent | 56ed9b0eb533ea38825c1be570f48334d1e457f0 (diff) | |
download | cmocka-9fc415a88f99b881b5c9f4c227c4967fd92d292a.tar.gz cmocka-9fc415a88f99b881b5c9f4c227c4967fd92d292a.tar.bz2 cmocka-9fc415a88f99b881b5c9f4c227c4967fd92d292a.zip |
tests: Add a group setup assert test
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r-- | tests/CMakeLists.txt | 8 | ||||
-rw-r--r-- | tests/test_group_setup_assert.c | 37 |
2 files changed, 45 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index faaa604..4b015ba 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -8,6 +8,7 @@ include_directories( set(CMOCKA_TESTS test_alloc + test_group_setup_assert test_group_setup_fail test_fixtures test_group_fixtures @@ -80,6 +81,13 @@ set_tests_properties( ) set_tests_properties( + test_group_setup_assert + PROPERTIES + WILL_FAIL + 1 +) + +set_tests_properties( test_group_setup_fail PROPERTIES WILL_FAIL diff --git a/tests/test_group_setup_assert.c b/tests/test_group_setup_assert.c new file mode 100644 index 0000000..eef61f8 --- /dev/null +++ b/tests/test_group_setup_assert.c @@ -0,0 +1,37 @@ +/* Use the unit test allocators */ +#define UNIT_TESTING 1 + +#include <stdarg.h> +#include <stddef.h> +#include <setjmp.h> +#include <cmocka.h> + +static int group_setup_failing(void **state) +{ + (void) state; /* unused */ + + assert_int_equal(0, 1); + + return 0; +} + +static void test_true(void **state) +{ + (void) state; /* unused */ + assert_true(1); +} + +static void test_false(void **state) +{ + (void) state; /* unused */ + assert_false(0); +} + +int main(void) { + const struct CMUnitTest tests[] = { + cmocka_unit_test(test_true), + cmocka_unit_test(test_false), + }; + + return cmocka_run_group_tests(tests, group_setup_failing, NULL); +} |