diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2020-10-05 16:54:04 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2020-10-05 16:56:49 +0200 |
commit | 7b91eaa93bebe6d16459b23e57038f94ce1fea3b (patch) | |
tree | e61f187431818418229f910020f02859477879f1 /tests | |
parent | 36c85066dee0113e0b743d886c001ae76ca1fea9 (diff) | |
download | cmocka-7b91eaa93bebe6d16459b23e57038f94ce1fea3b.tar.gz cmocka-7b91eaa93bebe6d16459b23e57038f94ce1fea3b.tar.xz cmocka-7b91eaa93bebe6d16459b23e57038f94ce1fea3b.zip |
cmocka: Remove cast in assert_string_(not_)equal macros
Also add basic tests
Fixes #48
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/test_string.c | 40 |
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b616a45..a1b31d4 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -27,6 +27,7 @@ set(CMOCKA_TESTS test_ordering_fail test_returns test_returns_fail + test_string test_wildcard test_skip_filter test_cmockery diff --git a/tests/test_string.c b/tests/test_string.c new file mode 100644 index 0000000..f1c9b7a --- /dev/null +++ b/tests/test_string.c @@ -0,0 +1,40 @@ +/* + * Copyright 2020 Andreas Schneider <asn@cryptomilk.org> + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <stdarg.h> +#include <stddef.h> +#include <stdint.h> +#include <setjmp.h> +#include <cmocka.h> + +static void torture_string_equal(void **state) +{ + assert_string_equal("wurst", "wurst"); +} + +static void torture_string_not_equal(void **state) +{ + assert_string_not_equal("wurst", "brot"); +} + +int main(void) { + const struct CMUnitTest tests[] = { + cmocka_unit_test(torture_string_equal), + cmocka_unit_test(torture_string_not_equal), + }; + + return cmocka_run_group_tests(tests, NULL, NULL); +} |