1 /*
2 * Copyright (c) 2025 Google, Inc.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 /** @file
8 * @brief Custom header assert test suite
9 *
10 */
11
12 #include <zephyr/kernel.h>
13 #include <zephyr/ztest.h>
14
15 #include <zephyr/sys/__assert.h>
16
17 static unsigned int last_assert_line;
18
assert_post_action(const char * file,unsigned int line)19 void assert_post_action(const char *file, unsigned int line)
20 {
21 last_assert_line = line;
22 }
23
24 ZTEST_SUITE(assert, NULL, NULL, NULL, NULL, NULL);
25
ZTEST(assert,test_assert_call)26 ZTEST(assert, test_assert_call)
27 {
28 /* Because CONFIG_ASSERT_TEST is not enabled in this test, and we're using a
29 * custom assert macro, this should not crash and the test should proceed.
30 */
31 __ASSERT(false, "This is a custom assert test");
32
33 zassert_true(last_assert_line != 0, "Assert was called on line 0");
34 }
35