1 /* -------------------------------- Arctic Core ------------------------------
2 * Arctic Core - the open source AUTOSAR platform http://arccore.com
4 * Copyright (C) 2009 ArcCore AB <contact@arccore.com>
6 * This source code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by the
8 * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * -------------------------------- Arctic Core ------------------------------*/
18 #include "Platform_Types.h"
19 #include "test_framework.h"
25 int _test_failed = 0;
\r
36 const char *description;
37 uint32_t expectedErrMask;
40 struct test testTable[50] = { {0} };
43 void testInit( void ) {
47 void test_done( void ) {
\r
48 printf( "\nTest summary\n"
\r
51 "FAIL : %d\n", _test_ok + _test_failed, _test_ok, _test_failed);
\r
62 void test_fail( const char *text,char *file, int line, const char *function ) {
\r
63 printf("%02d %02d FAILED, %s , %d, %s\n",test_suite, test_nr, file, line, function);
\r
64 testTable[testCnt].testSuite = test_suite;
65 testTable[testCnt].testNr = test_nr;
66 testTable[testCnt].status = TEST_FLG_ASSERT;
73 * Set errors that are expected during the test
76 void testSetErrorMask( uint32_t errMask ) {
81 void testValidateHook( void ) {
87 void testStart( const char *str, int testNr ) {
88 testTable[testCnt].status = TEST_FLG_RUNNING;
89 testTable[testCnt].testNr = testNr;
90 testTable[testCnt].description = str;
91 printf("%3d %3d %s\n",testCnt,testNr,str);
94 void testInc( void ) {
101 void testEnd( void ) {
102 uint16_t status = testTable[testCnt].status;
104 if( status & TEST_FLG_RUNNING ) {
105 if( status & TEST_FLG_ASSERT ) {
109 testTable[testCnt].status &= TEST_FLG_RUNNING;
110 testTable[testCnt].status |= TEST_FLG_OK;
113 printf("testEnd() on a test that is not running\n");
118 void testExit( int rv ) {
124 void test_ok( void ) {
\r
125 printf("%02d %02d OK\n",test_suite, test_nr);
126 testTable[testCnt].testSuite = test_suite;
127 testTable[testCnt].testNr = test_nr;
128 testTable[testCnt].status = 1;