Improve test macro.
Add include guards to the test header.
This commit is contained in:
		| @@ -3,10 +3,11 @@ | ||||
| # Also sets LATEST_TEST to point to the output executable of the test for easy | ||||
| # ADD_TEST()ing | ||||
| MACRO(CREATE_TEST headerfile sourcefile executablename) | ||||
| 	UNSET(test_moc_SRCS) #clear out the MOCs from previous tests | ||||
| 	QT4_WRAP_CPP(test_moc_SRCS ${headerfile}) | ||||
| 	ADD_EXECUTABLE(${executablename} ${sourcefile} ${test_moc_SRCS}) | ||||
| 	TARGET_LINK_LIBRARIES(${executablename} PolyVoxCore PolyVoxUtil ${QT_LIBRARIES}) | ||||
| 	SET(LATEST_TEST ${EXECUTABLE_OUTPUT_PATH}/${executablename}) | ||||
| 	SET(LATEST_TEST ${CMAKE_CURRENT_BINARY_DIR}/${executablename}) | ||||
| ENDMACRO(CREATE_TEST) | ||||
|  | ||||
| # Find the QTestLib stuff | ||||
| @@ -17,7 +18,6 @@ INCLUDE(${QT_USE_FILE}) | ||||
|  | ||||
| INCLUDE_DIRECTORIES(${PolyVox_SOURCE_DIR}/PolyVoxCore/include ${CMAKE_CURRENT_BINARY_DIR}) | ||||
|  | ||||
|  | ||||
| # Volume tests | ||||
| CREATE_TEST(testvolume.h testvolume.cpp testvolume) | ||||
| ADD_TEST(VolumeSizeTest ${LATEST_TEST} testSize) | ||||
|   | ||||
| @@ -23,8 +23,9 @@ freely, subject to the following restrictions: | ||||
|  | ||||
| #include "testvolume.h" | ||||
|  | ||||
| #include <Volume.h> | ||||
|  | ||||
| #include <QtTest> | ||||
| #include "Volume.h" | ||||
|  | ||||
| using namespace PolyVox; | ||||
|  | ||||
|   | ||||
| @@ -21,6 +21,9 @@ freely, subject to the following restrictions: | ||||
|     distribution. | ||||
| *******************************************************************************/ | ||||
|  | ||||
| #ifndef __PolyVox_TestVolume_H__ | ||||
| #define __PolyVox_TestVolume_H__ | ||||
|  | ||||
| #include <QObject> | ||||
|  | ||||
| class TestVolume: public QObject | ||||
| @@ -30,3 +33,5 @@ class TestVolume: public QObject | ||||
| 	private slots: | ||||
| 		void testSize(); | ||||
| }; | ||||
|  | ||||
| #endif | ||||
|   | ||||
		Reference in New Issue
	
	Block a user