Improve test macro.

Add include guards to the test header.
This commit is contained in:
Matt Williams 2010-02-26 16:11:13 +00:00
parent 6a828ec244
commit 7597b56620
3 changed files with 9 additions and 3 deletions

View File

@ -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)

View File

@ -23,8 +23,9 @@ freely, subject to the following restrictions:
#include "testvolume.h"
#include <Volume.h>
#include <QtTest>
#include "Volume.h"
using namespace PolyVox;

View File

@ -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