commit bce29e8601f1f06f2f1ac6c2cdb760776b8154c2
parent d0ebdea1b7f9c2cf0d13333132addacae2d6abea
Author: fundamental <mark.d.mccurry@gmail.com>
Date: Wed, 10 Aug 2011 23:56:30 -0400
Cmake: removing uneeded testing macro
- Using system provided macro for setting up cxxtests
Diffstat:
5 files changed, 27 insertions(+), 40 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
@@ -15,6 +15,7 @@ find_package(PortAudio)
set(FLTK_SKIP_OPENGL true)
find_package(FLTK)
find_package(OpenGL) #for FLTK
+find_package(CxxTest)
# lash
pkg_search_module(LASH lash-1.0)
mark_as_advanced(LASH_LIBRARIES)
@@ -220,34 +221,6 @@ include_directories(
)
-#for tests looking for files stored in the source dir
-add_definitions(-DSOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
-#macro for tests
-macro(unit_test NAME CXX_FILE FILES)
- if (CompileTests)
- set(PATH_FILES "")
- foreach(part ${FILES})
- set(PATH_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${part}" ${PATH_FILES})
- endforeach(part ${FILES})
- set(CXX_FILE_REAL "${CMAKE_CURRENT_SOURCE_DIR}/${CXX_FILE}")
- add_custom_command(
- OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${NAME}.cxx"
- COMMAND cxxtestgen.py --error-printer -o "${CMAKE_CURRENT_BINARY_DIR}/${NAME}.cxx" ${CXX_FILE_REAL}
- DEPENDS "${FILE}"
- )
- set(CXXTEST_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${NAME}.cxx")
- add_executable("${NAME}" "${CXXTEST_OUTPUT}" ${PATH_FILES})
- target_link_libraries("${NAME}" ${CXXTEST_LINK_LIBS}
- ${NONGUI_LIBRARIES}
- ${GUI_LIBRARIES}
- ${zlib_LIBRARIES}
- ${fftw_LIBRARIES}
- ${MXML_LIBRARIES}
- ${OS_LIBRARIES}
- )
- add_test("${NAME}" "${EXECUTABLE_OUTPUT_PATH}/${NAME}")
- endif()
-endmacro(unit_test)
set(NONGUI_LIBRARIES
zynaddsubfx_misc
diff --git a/src/Tests/AdNoteTest.h b/src/Tests/AdNoteTest.h
@@ -50,10 +50,10 @@ class AdNoteTest:public CxxTest::TestSuite
TS_ASSERT(!defaultPreset->VoicePar[1].Enabled);
XMLwrapper *wrap = new XMLwrapper();
- cout << string(SOURCE_DIR) + string("/Tests/guitar-adnote.xmz")
+ cout << string(SOURCE_DIR) + string("/guitar-adnote.xmz")
<< endl;
wrap->loadXMLfile(string(SOURCE_DIR)
- + string("/Tests/guitar-adnote.xmz"));
+ + string("/guitar-adnote.xmz"));
TS_ASSERT(wrap->enterbranch("MASTER"));
TS_ASSERT(wrap->enterbranch("PART", 0));
TS_ASSERT(wrap->enterbranch("INSTRUMENT"));
diff --git a/src/Tests/CMakeLists.txt b/src/Tests/CMakeLists.txt
@@ -1,8 +1,22 @@
-unit_test(ControllerTest ControllerTest.h ../Params/Controller.h)
-unit_test(EchoTest EchoTest.h ../Effects/Echo.h)
-unit_test(SampleTest SampleTest.h ../Samples/Sample.h)
-unit_test(MicrotonalTest MicrotonalTest.h ../Misc/Microtonal.h)
-unit_test(XMLwrapperTest XMLwrapperTest.h ../Misc/XMLwrapper.h)
-unit_test(ADnoteTest AdNoteTest.h ../Synth/ADnote.h)
-unit_test(SUBnoteTest SubNoteTest.h ../Synth/SUBnote.h)
-unit_test(OscilGenTest OscilGenTest.h ../Synth/OscilGen.h)
+#for tests looking for files stored in the source dir
+add_definitions(-DSOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
+
+CXXTEST_ADD_TEST(ControllerTest ControllerTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/ControllerTest.h)
+CXXTEST_ADD_TEST(EchoTest EchoTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/EchoTest.h)
+#CXXTEST_ADD_TEST(SampleTest SampleTest.h)
+CXXTEST_ADD_TEST(MicrotonalTest MicrotonalTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/MicrotonalTest.h)
+CXXTEST_ADD_TEST(XMLwrapperTest XMLwrapper.cpp ${CMAKE_CURRENT_SOURCE_DIR}/XMLwrapperTest.h)
+CXXTEST_ADD_TEST(ADnoteTest AdNoteTest.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/AdNoteTest.h)
+CXXTEST_ADD_TEST(SUBnoteTest SubNoteTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/SubNoteTest.h)
+CXXTEST_ADD_TEST(OscilGenTest OscilGenTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/OscilGenTest.h)
+
+set(test_lib ${NONGUI_LIBRARIES} ${zlib_LIBRARIES} ${fftw_LIBRARIES}
+ ${MXML_LIBRARIES})
+target_link_libraries(ADnoteTest ${test_lib})
+target_link_libraries(SUBnoteTest ${test_lib})
+target_link_libraries(ControllerTest ${test_lib})
+target_link_libraries(EchoTest ${test_lib})
+target_link_libraries(MicrotonalTest ${test_lib})
+target_link_libraries(OscilGenTest ${test_lib})
+target_link_libraries(XMLwrapperTest ${test_lib})
diff --git a/src/Tests/OscilGenTest.h b/src/Tests/OscilGenTest.h
@@ -37,7 +37,7 @@ class OscilGenTest:public CxxTest::TestSuite
XMLwrapper *wrap = new XMLwrapper();
wrap->loadXMLfile(string(SOURCE_DIR)
- + string("/Tests/guitar-adnote.xmz"));
+ + string("/guitar-adnote.xmz"));
TS_ASSERT(wrap->enterbranch("MASTER"));
TS_ASSERT(wrap->enterbranch("PART", 0));
TS_ASSERT(wrap->enterbranch("INSTRUMENT"));
diff --git a/src/Tests/SubNoteTest.h b/src/Tests/SubNoteTest.h
@@ -45,7 +45,7 @@ class SubNoteTest:public CxxTest::TestSuite
SUBnoteParameters *defaultPreset = new SUBnoteParameters();
XMLwrapper *wrap = new XMLwrapper();
wrap->loadXMLfile(string(SOURCE_DIR)
- + string("/Tests/guitar-adnote.xmz"));
+ + string("/guitar-adnote.xmz"));
TS_ASSERT(wrap->enterbranch("MASTER"));
TS_ASSERT(wrap->enterbranch("PART", 1));
TS_ASSERT(wrap->enterbranch("INSTRUMENT"));