SET(YACA_TEST "yaca-test")
ADD_EXECUTABLE(${YACA_TEST} ${yaca_test_SRCS})
+ADD_CUSTOM_TARGET(copy-test-vectors ALL
+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/test-vectors ${CMAKE_CURRENT_BINARY_DIR}/test-vectors
+ DEPENDS ${YACA_TEST})
+
IF(NOT DEFINED YACA_TEST_DIR)
SET(YACA_TEST_DIR "${SHARE_INSTALL_PREFIX}/${YACA_TEST}")
ENDIF(NOT DEFINED YACA_TEST_DIR)
## Install #####################################################################
INSTALL(TARGETS ${YACA_TEST} DESTINATION bin)
-INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test-vectors DESTINATION ${YACA_TEST_DIR})
\ No newline at end of file
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test-vectors DESTINATION ${YACA_TEST_DIR})
TestVectorVector loadTestVector(const std::string &filename)
{
- std::string path = std::string(YACA_TEST_DIR"/test-vectors/") + filename;
+ std::string path_local = std::string("./test-vectors/") + filename;
+ std::string path_shared = std::string(YACA_TEST_DIR"/test-vectors/") + filename;
TestVectorVector tvv;
- std::ifstream ifs(path, std::ifstream::in);
+ std::ifstream ifs(path_local, std::ifstream::in);
+ if (!ifs)
+ ifs.open(path_shared, std::ifstream::in);
- RUNNER_ASSERT_MSG(ifs, "Failed to open " << path);
+ RUNNER_ASSERT_MSG(ifs, "Failed to open " << filename);
std::string line;
TestVector tv;
while (std::getline(ifs, line))
if (ifs.eof())
break;
}
- RUNNER_ASSERT_MSG(ifs.eof(), "Failed to read " << path);
+ RUNNER_ASSERT_MSG(ifs.eof(), "Failed to read " << filename);
if (!tv.empty())
tvv.push_back(tv);
return tvv;