source: rtems/testsuites/sptests/spfatal10/testcase.h @ 68f36d14

4.115
Last change on this file since 68f36d14 was 68f36d14, checked in by Sebastian Huber <sebastian.huber@…>, on 01/27/13 at 13:02:50

score: Add and use rtems_assert_context

  • Property mode set to 100644
File size: 1.3 KB
Line 
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
25static 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
36void force_error()
37{
38  __assert_func( ASSERT_FILE, ASSERT_LINE, ASSERT_FUNC, ASSERT_FEXP );
39
40  /* we will not run this far */
41}
Note: See TracBrowser for help on using the repository browser.