#ADD_SUBDIRECTORY(/usr/src/gtest gtest)
ADD_SUBDIRECTORY(/usr/src/gmock gmock)
enable_testing()
-target_link_libraries(fridatest gmock gtest gmock_main ${QT_LIBRARIES} ${LLVM_LDFLAGS} -lLLVM-3.5 ${LLVM_SYSTEM_LIBS} ${LOG4CXX_LDFLAGS} ${GUILE_LDFLAGS} ${QUAZIP_LIBRARIES})
-add_test(NAME fridatest COMMAND fridatest WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+target_link_libraries(fridatest gmock gtest ${QT_LIBRARIES} ${LLVM_LDFLAGS} -lLLVM-3.5 ${LLVM_SYSTEM_LIBS} ${LOG4CXX_LDFLAGS} ${GUILE_LDFLAGS} ${QUAZIP_LIBRARIES})
+add_test(NAME fridatest COMMAND fridatest ${CMAKE_SOURCE_DIR})
#include "core/InformationManager.hxx"
#include "core/BasicBlock.hxx"
+extern char * TEST_DATA_DIRECTORY;
+
TEST(BasicBlockTest, deserializeValidInstance) {
- QFile file("testdata/core/BasicBlock/valid.xml");
+ QFile file(QString(TEST_DATA_DIRECTORY) + "/testdata/core/BasicBlock/valid.xml");
InformationManager manager;
file.open(QFile::ReadOnly | QFile::Text);
QXmlStreamReader reader(&file);
}
TEST(BasicBlockTest, deserializeInvalidInstance) {
- QFile file("testdata/core/BasicBlock/invalid.xml");
+ QFile file(QString(TEST_DATA_DIRECTORY) + "/testdata/core/BasicBlock/invalid.xml");
InformationManager manager;
file.open(QFile::ReadOnly | QFile::Text);
QXmlStreamReader reader(&file);
}
TEST(BasicBlockTest, deserializeThenSerializeIsIdentity) {
- QFile infile("testdata/core/BasicBlock/valid.xml");
+ QFile infile(QString(TEST_DATA_DIRECTORY) + "/testdata/core/BasicBlock/valid.xml");
QTemporaryFile outfile;
InformationManager manager;
#include "core/BasicBlock.hxx"
#include "core/Function.hxx"
+extern char * TEST_DATA_DIRECTORY;
+
TEST(FunctionTest, deserializeValidInstance) {
- QFile file("testdata/core/Function/valid.xml");
+ QFile file(QString(TEST_DATA_DIRECTORY) + "/testdata/core/Function/valid.xml");
InformationManager manager;
file.open(QFile::ReadOnly | QFile::Text);
QXmlStreamReader reader(&file);
#include <gtest/gtest.h>
+char* TEST_DATA_DIRECTORY;
+
+int main(int argc, char **argv) {
+ testing::InitGoogleTest(&argc, argv);
+
+ if (argc > 1)
+ TEST_DATA_DIRECTORY = argv[1];
+ else
+ TEST_DATA_DIRECTORY = "./";
+
+ return RUN_ALL_TESTS();
+}