[Kst] branches/work/kst/portto4/kst

Peter Kümmel syntheticpp at gmx.net
Wed Jan 12 15:24:12 CET 2011


SVN commit 1214005 by kuemmel:

cmake: add unit tests, one binary for each test, run tests with "make test"

 M  +3 -2      INSTALL  
 M  +6 -4      cmake/CMakeLists.txt  
 M  +2 -0      cmake/modules/KstMacros.cmake  
 A             cmake/tests (directory)  
 AM            cmake/tests/CMakeLists.txt  
 A             cmake/tests/allinone (directory)  
 AM            cmake/tests/allinone/CMakeLists.txt  
 M  +4 -0      tests/testcsd.cpp  
 M  +4 -0      tests/testdatamatrix.cpp  
 M  +4 -0      tests/testdatasource.cpp  
 M  +4 -0      tests/testeditablematrix.cpp  
 M  +4 -0      tests/testeqparser.cpp  
 M  +4 -0      tests/testgeneratedmatrix.cpp  
 M  +4 -0      tests/testhistogram.cpp  
 M  +4 -0      tests/testlabelparser.cpp  
 M  +4 -0      tests/testmatrix.cpp  
 M  +4 -0      tests/testobjectstore.cpp  
 M  +4 -0      tests/testpsd.cpp  
 M  +4 -0      tests/testscalar.cpp  
 M  +4 -0      tests/testvector.cpp  


--- branches/work/kst/portto4/kst/INSTALL #1214004:1214005
@@ -107,7 +107,9 @@
 	-- kst_merge_rebuild        = OFF    : Rebuild generated files from merged files build
 	-- kst_verbose              = OFF    : Make verbose CMake run and Makefiles
 	-- kst_install_prefix       = OFF    : Install path for Kst, using a default if not set
-	-- kst_3rdparty             = OFF    : Build plugins depending on 3rd party libraries
+	-- kst_console              = OFF    : Open console on Windows
+	-- kst_3rdparty             = ON     : Build plugins depending on 3rd party libraries
+	-- kst_tests                = OFF    : Build unit tests
 
 	
 	To enable a option pass the value ON or 1, eg
@@ -129,5 +131,4 @@
 	- install on Mac
 	- add package rules
 	- add support for pre-compiled headers
-	- build and run tests
 	- have a look at kst1's cmake files, especially the 3rd party lib code
--- branches/work/kst/portto4/kst/cmake/CMakeLists.txt #1214004:1214005
@@ -24,7 +24,9 @@
 kst_option(install_prefix "Install path for Kst, using a default if not set" OFF all)
 kst_option(console "Open console on Windows" OFF win)
 kst_option(3rdparty "Build plugins depending on 3rd party libraries" ON all)
+kst_option(tests "Build unit tests" ON all)
 
+
 message(STATUS)
 
 # Find 3rd party libraries
@@ -123,13 +125,13 @@
 
 
 add_subdirectory(src)
+if(kst_tests)
+	enable_testing()
+	add_subdirectory(tests)
+endif()
 
-add_dependencies(kstcore Revision)
-add_dependencies(kstapp  Revision)
-add_dependencies(kst     Revision)
 
 
-
 if(WIN32)
 	install(FILES
 		${QT_BINARY_DIR}/QtCore4.dll
--- branches/work/kst/portto4/kst/cmake/modules/KstMacros.cmake #1214004:1214005
@@ -48,6 +48,7 @@
 	add_executable(${kst_name} ${ARGN} ${kst_${kst_name}_sources} ${kst_${kst_name}_headers} ${kst_${kst_name}_info_files})
 	target_link_libraries(${kst_name} ${kst_qtmain_library})
 	set_property(TARGET ${kst_name} PROPERTY DEBUG_POSTFIX ${kst_debug_postfix})
+	add_dependencies(${kst_name} Revision)
 endmacro()
 
 
@@ -85,6 +86,7 @@
 		add_library(${kst_name} ${type} ${kst_${kst_name}_sources} ${kst_${kst_name}_headers} ${svnversion_h})
 	endif()
 	set_property(TARGET ${kst_name} PROPERTY DEBUG_POSTFIX ${kst_debug_postfix})
+	add_dependencies(${kst_name} Revision)
 	if(WIN32)
 		install(TARGETS ${kst_name} RUNTIME DESTINATION bin
 		                            ARCHIVE DESTINATION lib)
--- branches/work/kst/portto4/kst/tests/testcsd.cpp #1214004:1214005
@@ -237,3 +237,7 @@
 //   QCOMPARE(outMatrix->value(2, 2), -0.293267);
 
 }
+
+#ifdef KST_USE_QTEST_MAIN
+QTEST_MAIN(TestCSD)
+#endif
\ No newline at end of file
--- branches/work/kst/portto4/kst/tests/testdatamatrix.cpp #1214004:1214005
@@ -90,4 +90,8 @@
   QVERIFY(ok);
 }
 
+#ifdef KST_USE_QTEST_MAIN
+QTEST_MAIN(TestDataMatrix)
+#endif
+
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/tests/testdatasource.cpp #1214004:1214005
@@ -710,4 +710,8 @@
   }
 }
 
+#ifdef KST_USE_QTEST_MAIN
+QTEST_MAIN(TestDataSource)
+#endif
+
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/tests/testeditablematrix.cpp #1214004:1214005
@@ -313,3 +313,7 @@
   QVERIFY(sm->minValueNoSpike() >= 1E+300 );
   QVERIFY(sm->maxValueNoSpike() <= -1E+300);
 }
+
+#ifdef KST_USE_QTEST_MAIN
+QTEST_MAIN(TestEditableMatrix)
+#endif
--- branches/work/kst/portto4/kst/tests/testeqparser.cpp #1214004:1214005
@@ -634,4 +634,8 @@
   QVERIFY(validateParserFailures("2*sin(x)()"));
 }
 
+#ifdef KST_USE_QTEST_MAIN
+QTEST_MAIN(TestEqParser)
+#endif
+
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/tests/testgeneratedmatrix.cpp #1214004:1214005
@@ -57,4 +57,8 @@
   QVERIFY(ok);
 }
 
+#ifdef KST_USE_QTEST_MAIN
+QTEST_MAIN(TestGeneratedMatrix)
+#endif
+
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/tests/testhistogram.cpp #1214004:1214005
@@ -133,4 +133,8 @@
   QCOMPARE(h1->xMax(), 10.0);
 }
 
+#ifdef KST_USE_QTEST_MAIN
+QTEST_MAIN(TestHistogram)
+#endif
+
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/tests/testlabelparser.cpp #1214004:1214005
@@ -480,4 +480,8 @@
 }
 
 
+#ifdef KST_USE_QTEST_MAIN
+QTEST_MAIN(TestLabelParser)
+#endif
+
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/tests/testmatrix.cpp #1214004:1214005
@@ -177,4 +177,8 @@
   QVERIFY(sm->maxValueNoSpike() <= -1E+300);
 }
 
+#ifdef KST_USE_QTEST_MAIN
+QTEST_MAIN(TestMatrix)
+#endif
+
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/tests/testobjectstore.cpp #1214004:1214005
@@ -60,4 +60,8 @@
   QVERIFY(!p);  // make sure object gets deleted when last reference is gone
 }
 
+#ifdef KST_USE_QTEST_MAIN
+QTEST_MAIN(TestObjectStore)
+#endif
+
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/tests/testpsd.cpp #1214004:1214005
@@ -197,4 +197,8 @@
 //   Kst::VectorPtr vpVY = psdDOM->vY();
 }
 
+#ifdef KST_USE_QTEST_MAIN
+QTEST_MAIN(TestPSD)
+#endif
+
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/tests/testscalar.cpp #1214004:1214005
@@ -134,4 +134,8 @@
   delete listener;
 }
 
+#ifdef KST_USE_QTEST_MAIN
+QTEST_MAIN(TestScalar)
+#endif
+
 // vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/tests/testvector.cpp #1214004:1214005
@@ -60,4 +60,8 @@
   QCOMPARE(v2->interpolate(4, 5), 3.0);
 }
 
+#ifdef KST_USE_QTEST_MAIN
+QTEST_MAIN(TestVector)
+#endif
+
 // vim: ts=2 sw=2 et


More information about the Kst mailing list