From 4a03650c9b09532ccb9b4578c73746582af852ce Mon Sep 17 00:00:00 2001 From: Christoph Egger Date: Tue, 24 Mar 2015 16:31:58 +0100 Subject: [PATCH] Use QString::arg to construct testcase filenames --- CMakeLists.txt | 2 +- src/core/tests/BasicBlockTest.cxx | 6 +++--- src/core/tests/FunctionTest.cxx | 2 +- src/test.cxx | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3529b48..e72d439 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/src/core/tests/BasicBlockTest.cxx b/src/core/tests/BasicBlockTest.cxx index 27072c8..e4095ff 100644 --- a/src/core/tests/BasicBlockTest.cxx +++ b/src/core/tests/BasicBlockTest.cxx @@ -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; diff --git a/src/core/tests/FunctionTest.cxx b/src/core/tests/FunctionTest.cxx index 0d3e56d..af95bd0 100644 --- a/src/core/tests/FunctionTest.cxx +++ b/src/core/tests/FunctionTest.cxx @@ -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); diff --git a/src/test.cxx b/src/test.cxx index 9f73274..36fb3b4 100644 --- a/src/test.cxx +++ b/src/test.cxx @@ -4,7 +4,7 @@ #include #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(); } -- 2.39.5