2 * Copyright 2008 Google Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 #include "assert_module.h"
23 extern void increment_value(int * const value);
25 /* This test case will fail but the assert is caught by run_tests() and the
26 * next test is executed. */
27 static void increment_value_fail(void **state) {
30 increment_value(NULL);
33 /* This test case succeeds since increment_value() asserts on the NULL
35 static void increment_value_assert(void **state) {
38 expect_assert_failure(increment_value(NULL));
41 /* This test case fails since decrement_value() doesn't assert on a NULL
43 static void decrement_value_fail(void **state) {
46 expect_assert_failure(decrement_value(NULL));
50 const UnitTest tests[] = {
51 unit_test(increment_value_fail),
52 unit_test(increment_value_assert),
53 unit_test(decrement_value_fail),
55 return run_tests(tests);