1/*
2 * COPYRIGHT AND PERMISSION NOTICE
3 *
4 * Copyright (c) 2003 Embedded Unit Project
5 *
6 * All rights reserved.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining
9 * a copy of this software and associated documentation files (the
10 * "Software"), to deal in the Software without restriction, including
11 * without limitation the rights to use, copy, modify, merge, publish,
12 * distribute, and/or sell copies of the Software, and to permit persons
13 * to whom the Software is furnished to do so, provided that the above
14 * copyright notice(s) and this permission notice appear in all copies
15 * of the Software and that both the above copyright notice(s) and this
16 * permission notice appear in supporting documentation.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
21 * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
22 * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
23 * SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
24 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
25 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
26 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
27 *
28 * Except as contained in this notice, the name of a copyright holder
29 * shall not be used in advertising or otherwise to promote the sale,
30 * use or other dealings in this Software without prior written
31 * authorization of the copyright holder.
32 *
33 * $Id: AssertImpl.h,v 1.6 2003/09/16 11:09:53 arms22 Exp $
34 */
35#ifndef	__ASSERTIMPL_H__
36#define	__ASSERTIMPL_H__
37
38#ifdef	__cplusplus
39extern "C" {
40#endif
41
42void addFailure(const char *msg, long line, const char *file);	/*TestCase.c*/
43
44void assertImplementationInt(int expected,int actual, long line, const char *file);
45void assertImplementationCStr(const char *expected,const char *actual, long line, const char *file);
46
47#define TEST_ASSERT_EQUAL_STRING(expected,actual)\
48	if (expected && actual && (stdimpl_strcmp(expected,actual)==0)) {} else {assertImplementationCStr(expected,actual,__LINE__,__FILE__);return;}
49
50#define TEST_ASSERT_EQUAL_INT(expected,actual)\
51	if (expected == actual) {} else {assertImplementationInt(expected,actual,__LINE__,__FILE__);return;}
52
53#define TEST_ASSERT_NULL(pointer)\
54	TEST_ASSERT_MESSAGE(pointer == NULL,#pointer " was not null.")
55
56#define TEST_ASSERT_NOT_NULL(pointer)\
57	TEST_ASSERT_MESSAGE(pointer != NULL,#pointer " was null.")
58
59#define TEST_ASSERT_MESSAGE(condition, message)\
60	if (condition) {} else {TEST_FAIL(message);}
61
62#define TEST_ASSERT(condition)\
63	if (condition) {} else {TEST_FAIL(#condition);}
64
65#define TEST_FAIL(message)\
66	if (0) {} else {addFailure(message,__LINE__,__FILE__);return;}
67
68#ifdef	__cplusplus
69}
70#endif
71
72#endif/*__ASSERTIMPL_H__*/
73