Use QString::arg to construct testcase filenames
authorChristoph Egger <Christoph.Egger@fau.de>
Tue, 24 Mar 2015 15:31:58 +0000 (16:31 +0100)
committerChristoph Egger <Christoph.Egger@fau.de>
Tue, 24 Mar 2015 15:44:19 +0000 (16:44 +0100)
CMakeLists.txt
src/core/tests/BasicBlockTest.cxx
src/core/tests/FunctionTest.cxx
src/test.cxx

index 3529b485fb3c2c5490edeee16e62f8604bbad076..e72d4396d2e4e1e108b26bc68ad338afdababbae 100644 (file)
@@ -138,7 +138,7 @@ qt5_use_modules(fridatest Widgets)
 #ADD_SUBDIRECTORY(/usr/src/gtest gtest)
 ADD_SUBDIRECTORY(/usr/src/gmock gmock)
 enable_testing()
-add_test(NAME fridatest COMMAND fridatest ${CMAKE_SOURCE_DIR})
+add_test(NAME fridatest COMMAND fridatest ${CMAKE_SOURCE_DIR}/testdata)
 target_link_libraries(fridatest gmock gtest ${QT_LIBRARIES} ${LLVM_LDFLAGS} -lLLVM-3.5 ${LLVM_SYSTEM_LIBS} ${LOG4CXX_LDFLAGS} ${GUILE_LDFLAGS} ${QUAZIP_LIBRARIES})
 target_compile_options(fridatest PRIVATE -DCONFIG_TEST)
 set_property(TEST fridatest
index 27072c8cf733db3c181848049805b5dbd4bdfc09..e4095ff15f9f246d2a43f97915a24a2636861ac2 100644 (file)
@@ -8,7 +8,7 @@
 extern char * TEST_DATA_DIRECTORY;
 
 TEST(BasicBlockTest, deserializeValidInstance) {
-       QFile file(QString(TEST_DATA_DIRECTORY) + "/testdata/core/BasicBlock/valid.xml");
+       QFile file(QString("%1/%2").arg(TEST_DATA_DIRECTORY, "/core/BasicBlock/valid.xml"));
        InformationManager manager;
        file.open(QFile::ReadOnly | QFile::Text);
        QXmlStreamReader reader(&file);
@@ -24,7 +24,7 @@ TEST(BasicBlockTest, deserializeValidInstance) {
 }
 
 TEST(BasicBlockTest, deserializeInvalidInstance) {
-       QFile file(QString(TEST_DATA_DIRECTORY) + "/testdata/core/BasicBlock/invalid.xml");
+       QFile file(QString("%1/%2").arg(TEST_DATA_DIRECTORY, "/core/BasicBlock/invalid.xml"));
        InformationManager manager;
        file.open(QFile::ReadOnly | QFile::Text);
        QXmlStreamReader reader(&file);
@@ -36,7 +36,7 @@ TEST(BasicBlockTest, deserializeInvalidInstance) {
 }
 
 TEST(BasicBlockTest, deserializeThenSerializeIsIdentity) {
-       QFile infile(QString(TEST_DATA_DIRECTORY) + "/testdata/core/BasicBlock/valid.xml");
+       QFile infile(QString("%1/%2").arg(TEST_DATA_DIRECTORY, "/core/BasicBlock/valid.xml"));
        QTemporaryFile outfile;
 
        InformationManager manager;
index 0d3e56d5791c95b12387356f0ac08f098fe053c4..af95bd046c75e5bfa1e2258fb304becd89eeb31a 100644 (file)
@@ -8,7 +8,7 @@
 extern char * TEST_DATA_DIRECTORY;
 
 TEST(FunctionTest, deserializeValidInstance) {
-       QFile file(QString(TEST_DATA_DIRECTORY) + "/testdata/core/Function/valid.xml");
+       QFile file(QString("%1/%2").arg(TEST_DATA_DIRECTORY, "/core/Function/valid.xml"));
        InformationManager manager;
        file.open(QFile::ReadOnly | QFile::Text);
        QXmlStreamReader reader(&file);
index 9f73274dc04cbbe0c82a47c0f978fc7519d3a69b..36fb3b44218e29f90c791a7ae91afaef36cb306b 100644 (file)
@@ -4,7 +4,7 @@
 #include <QApplication>
 #include "Config.hxx"
 
-char* TEST_DATA_DIRECTORY;
+const char* TEST_DATA_DIRECTORY;
 
 int main(int argc, char **argv) {
        testing::InitGoogleTest(&argc, argv);
@@ -14,7 +14,7 @@ int main(int argc, char **argv) {
        if (argc > 1)
                TEST_DATA_DIRECTORY = argv[1];
        else
-               TEST_DATA_DIRECTORY = "./";
+               TEST_DATA_DIRECTORY = "./testdata";
 
        return RUN_ALL_TESTS();
 }