Commit 4d510d1d authored by Sigurd M. Albrektsen's avatar Sigurd M. Albrektsen

Moved file loading functions to test_utils.

parent 36bac2d3
......@@ -55,6 +55,7 @@ endif()
set(SENTIBOARD_TEST_SRCS
${TEST_SRC_DIR}/testmain.cpp
${TEST_SRC_DIR}/sentiboard_reader_test.cpp
${TEST_SRC_DIR}/test_utils.cpp
)
add_executable(${TEST_TARGET}
......@@ -79,4 +80,3 @@ if (CMAKE_BUILD_TYPE STREQUAL "Coverage")
SETUP_TARGET_FOR_COVERAGE(test_coverage ${TEST_TARGET} ${PROJECT_SOURCE_DIR}/coverage)
endif() #CMAKE_BUILD_TYPE STREQUAL "Coverage"
......@@ -8,30 +8,7 @@
#include "framework/test_framework.hpp"
#include "sentiboard/Reader.hpp"
const char kPathSeparator =
#ifdef _WIN32
'\\';
#else
'/';
#endif
std::string get_foldername(const std::string& str) {
size_t found;
found = str.find_last_of("/\\");
return str.substr(0, found);
}
std::string get_testdata_directory() {
std::string dir = get_foldername(__FILE__) + kPathSeparator + "test_files"
+ kPathSeparator;
return dir;
}
std::string get_testdata_file(const std::string& sensor,
const std::string& filename) {
return get_testdata_directory() + kPathSeparator + sensor + kPathSeparator
+ filename;
}
#include "test_utils.hpp"
TEST_CASE("Live Read Test", "[!mayfail]") {
sentiboard::Reader reader("/dev/ttySentiboard02");
......
// Copyright [2017] <Sigurd M. Albrektsen>
#include "test_utils.hpp"
const char kPathSeparator =
#ifdef _WIN32
'\\';
#else
'/';
#endif
std::string get_foldername(const std::string& str) {
size_t found;
found = str.find_last_of("/\\");
return str.substr(0, found);
}
std::string get_testdata_directory() {
std::string dir = get_foldername(__FILE__) + kPathSeparator + "test_files"
+ kPathSeparator;
return dir;
}
std::string get_testdata_file(const std::string& sensor,
const std::string& filename) {
return get_testdata_directory() + kPathSeparator + sensor + kPathSeparator
+ filename;
}
// Copyright [2017] <Sigurd M. Albrektsen>
#ifndef TESTS_TEST_UTILS_HPP_
#define TESTS_TEST_UTILS_HPP_
#include <string>
std::string get_foldername(const std::string& str);
std::string get_testdata_directory();
std::string get_testdata_file(const std::string& sensor,
const std::string& filename);
#endif // TESTS_TEST_UTILS_HPP_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment