1 | /* Test __assert_func with NULL function name |
---|
2 | * |
---|
3 | * COPYRIGHT (c) 1989-2009. |
---|
4 | * On-Line Applications Research Corporation (OAR). |
---|
5 | * |
---|
6 | * The license and distribution terms for this file may be |
---|
7 | * found in the file LICENSE in this distribution or at |
---|
8 | * http://www.rtems.com/license/LICENSE. |
---|
9 | */ |
---|
10 | |
---|
11 | #include <assert.h> |
---|
12 | #include <string.h> |
---|
13 | |
---|
14 | #define FATAL_ERROR_TEST_NAME "10" |
---|
15 | #define FATAL_ERROR_DESCRIPTION "asserting with non-NULL strings..." |
---|
16 | #define FATAL_ERROR_EXPECTED_SOURCE RTEMS_FATAL_SOURCE_ASSERT |
---|
17 | #define FATAL_ERROR_EXPECTED_IS_INTERNAL FALSE |
---|
18 | #define FATAL_ERROR_EXPECTED_ERROR_CHECK spfatal10_is_expected_error |
---|
19 | |
---|
20 | #define ASSERT_FILE "testcase.h" |
---|
21 | #define ASSERT_LINE 38 |
---|
22 | #define ASSERT_FUNC "Init" |
---|
23 | #define ASSERT_FEXP "forced" |
---|
24 | |
---|
25 | static inline bool spfatal10_is_expected_error( rtems_fatal_code error ) |
---|
26 | { |
---|
27 | const rtems_assert_context *assert_context = |
---|
28 | (const rtems_assert_context *) error; |
---|
29 | |
---|
30 | return strcmp( assert_context->file, ASSERT_FILE ) == 0 |
---|
31 | && assert_context->line == ASSERT_LINE |
---|
32 | && strcmp( assert_context->function, ASSERT_FUNC ) == 0 |
---|
33 | && strcmp( assert_context->failed_expression, ASSERT_FEXP ) == 0; |
---|
34 | } |
---|
35 | |
---|
36 | void force_error() |
---|
37 | { |
---|
38 | __assert_func( ASSERT_FILE, ASSERT_LINE, ASSERT_FUNC, ASSERT_FEXP ); |
---|
39 | |
---|
40 | /* we will not run this far */ |
---|
41 | } |
---|