1 /** 2 * @file 3 */ 4 5 /* 6 Copyright (C) 2002-2013 UFO: Alien Invasion. 7 8 This program is free software; you can redistribute it and/or 9 modify it under the terms of the GNU General Public License 10 as published by the Free Software Foundation; either version 2 11 of the License, or (at your option) any later version. 12 13 This program is distributed in the hope that it will be useful, 14 but WITHOUT ANY WARRANTY; without even the implied warranty of 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 17 See the GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program; if not, write to the Free Software 21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22 23 */ 24 25 #pragma once 26 27 #include <CUnit/Basic.h> 28 #include "../common/common.h" 29 #include "../shared/shared.h" 30 31 #define UFO_CU_ASSERT_EQUAL_INT_MSG_FATAL(actual, expected, msg) \ 32 { CU_assertImplementation(((actual) == (expected)), __LINE__, msg ? msg : va("UFO_CU_ASSERT(%i but expected %i)", actual, expected), __FILE__, "", CU_TRUE); } 33 34 #define UFO_CU_ASSERT_EQUAL_INT_MSG(actual, expected, msg) \ 35 { CU_assertImplementation(((actual) == (expected)), __LINE__, msg ? msg : va("UFO_CU_ASSERT(%i but expected %i)", actual, expected), __FILE__, "", CU_FALSE); } 36 37 #define UFO_CU_ASSERT_NOT_EQUAL_INT_MSG(actual, expected, msg) \ 38 { CU_assertImplementation(((actual) != (expected)), __LINE__, msg ? msg : va("UFO_CU_ASSERT(%i equals %i)", actual, expected), __FILE__, "", CU_FALSE); } 39 40 #define UFO_CU_ASSERT_TRUE_MSG(value, msg) \ 41 { CU_assertImplementation((value), __LINE__, msg ? msg : ("UFO_CU_ASSERT(" #value ")"), __FILE__, "", CU_FALSE); } 42 43 #define UFO_CU_ASSERT_MSG(msg) \ 44 { CU_assertImplementation(CU_FALSE, __LINE__, msg, __FILE__, "", CU_FALSE); } 45 46 #define UFO_CU_FAIL_MSG(msg) \ 47 { CU_assertImplementation(CU_FALSE, __LINE__, va("UFO_CU_FAIL(\"%s\")", msg), __FILE__, "", CU_FALSE); } 48 49 #define UFO_CU_FAIL_MSG_FATAL(msg) \ 50 { CU_assertImplementation(CU_FALSE, __LINE__, va("UFO_CU_FAIL(\"%s\")", msg), __FILE__, "", CU_TRUE); } 51 52 void TEST_vPrintf(const char* fmt, va_list argptr); 53 void TEST_Init(void); 54 void TEST_Shutdown(void); 55 56 /** interface to allow to custom tests with command line */ 57 void TEST_RegisterProperty(const char* name, const char* value); 58 bool TEST_ExistsProperty (const char* name); 59 int TEST_GetIntProperty(const char* name); 60 long TEST_GetLongProperty(const char* name); 61 const char* TEST_GetStringProperty(const char* name); 62