From 7597b566208987f179018f44170c6d2b42e789b2 Mon Sep 17 00:00:00 2001 From: Matt Williams Date: Fri, 26 Feb 2010 16:11:13 +0000 Subject: [PATCH] Improve test macro. Add include guards to the test header. --- tests/CMakeLists.txt | 4 ++-- tests/testvolume.cpp | 3 ++- tests/testvolume.h | 5 +++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 92fe8671..7ca125a1 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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) diff --git a/tests/testvolume.cpp b/tests/testvolume.cpp index fbb42cec..4b9a9082 100644 --- a/tests/testvolume.cpp +++ b/tests/testvolume.cpp @@ -23,8 +23,9 @@ freely, subject to the following restrictions: #include "testvolume.h" +#include + #include -#include "Volume.h" using namespace PolyVox; diff --git a/tests/testvolume.h b/tests/testvolume.h index 97767817..2bfe79b6 100644 --- a/tests/testvolume.h +++ b/tests/testvolume.h @@ -21,6 +21,9 @@ freely, subject to the following restrictions: distribution. *******************************************************************************/ +#ifndef __PolyVox_TestVolume_H__ +#define __PolyVox_TestVolume_H__ + #include class TestVolume: public QObject @@ -30,3 +33,5 @@ class TestVolume: public QObject private slots: void testSize(); }; + +#endif