EmbUnit library for mbed. EmbUnit is a unit testing framework for embedded software. (more info: http://embunit.sourceforge.net/ )
AssertImpl.h
00001 /* 00002 * COPYRIGHT AND PERMISSION NOTICE 00003 * 00004 * Copyright (c) 2003 Embedded Unit Project 00005 * 00006 * All rights reserved. 00007 * 00008 * Permission is hereby granted, free of charge, to any person obtaining 00009 * a copy of this software and associated documentation files (the 00010 * "Software"), to deal in the Software without restriction, including 00011 * without limitation the rights to use, copy, modify, merge, publish, 00012 * distribute, and/or sell copies of the Software, and to permit persons 00013 * to whom the Software is furnished to do so, provided that the above 00014 * copyright notice(s) and this permission notice appear in all copies 00015 * of the Software and that both the above copyright notice(s) and this 00016 * permission notice appear in supporting documentation. 00017 * 00018 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00019 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00020 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 00021 * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 00022 * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY 00023 * SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER 00024 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF 00025 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 00026 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 00027 * 00028 * Except as contained in this notice, the name of a copyright holder 00029 * shall not be used in advertising or otherwise to promote the sale, 00030 * use or other dealings in this Software without prior written 00031 * authorization of the copyright holder. 00032 * 00033 * $Id: AssertImpl.h,v 1.6 2003/09/16 11:09:53 arms22 Exp $ 00034 */ 00035 #ifndef __ASSERTIMPL_H__ 00036 #define __ASSERTIMPL_H__ 00037 00038 #ifdef __cplusplus 00039 //extern "C" { 00040 #endif 00041 00042 void addFailure(const char *msg, long line, const char *file); /*TestCase.c*/ 00043 00044 void assertImplementationInt(int expected,int actual, long line, const char *file); 00045 void assertImplementationCStr(const char *expected,const char *actual, long line, const char *file); 00046 00047 #define TEST_ASSERT_EQUAL_STRING(expected,actual)\ 00048 if (expected && actual && (stdimpl_strcmp(expected,actual)==0)) {} else {assertImplementationCStr(expected,actual,__LINE__,__FILE__);return;} 00049 00050 #define TEST_ASSERT_EQUAL_INT(expected,actual)\ 00051 if (expected == actual) {} else {assertImplementationInt(expected,actual,__LINE__,__FILE__);return;} 00052 00053 #define TEST_ASSERT_NULL(pointer)\ 00054 TEST_ASSERT_MESSAGE(pointer == NULL,#pointer " was not null.") 00055 00056 #define TEST_ASSERT_NOT_NULL(pointer)\ 00057 TEST_ASSERT_MESSAGE(pointer != NULL,#pointer " was null.") 00058 00059 #define TEST_ASSERT_MESSAGE(condition, message)\ 00060 if (condition) {} else {TEST_FAIL(message);} 00061 00062 #define TEST_ASSERT(condition)\ 00063 if (condition) {} else {TEST_FAIL(#condition);} 00064 00065 #define TEST_FAIL(message)\ 00066 if (0) {} else {addFailure(message,__LINE__,__FILE__);return;} 00067 00068 #ifdef __cplusplus 00069 00070 #endif 00071 00072 #endif/*__ASSERTIMPL_H__*/
Generated on Wed Jul 13 2022 18:17:56 by 1.7.2