mirror of
https://git.gfz-potsdam.de/naaice/tug.git
synced 2025-12-13 09:28:23 +01:00
Merge branch 'fix-pipeline' into 'csv-to-eigen'
Fix handling of CSV file See merge request naaice/tug!8
This commit is contained in:
commit
bc9e92e3ef
@ -14,6 +14,13 @@ endif()
|
||||
add_executable(testTug setup.cpp testBoundaryCondition.cpp testDiffusion.cpp testSimulation.cpp)
|
||||
target_link_libraries(testTug doctest tug)
|
||||
|
||||
# get relative path of the CSV file
|
||||
get_filename_component(testSimulationCSV "FTCS_11_11_7000.csv" REALPATH CACHE)
|
||||
# set relative path in header file
|
||||
configure_file(testSimulation.hpp.in testSimulation.hpp)
|
||||
# include test directory with generated header file from above
|
||||
target_include_directories(testTug PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
add_custom_target(
|
||||
check
|
||||
COMMAND $<TARGET_FILE:testTug>
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
#include <stdio.h>
|
||||
#include <doctest/doctest.h>
|
||||
#include <tug/Simulation.hpp>
|
||||
#include <filesystem>
|
||||
#include "TestUtils.cpp"
|
||||
#include <string>
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
// include the configured header file
|
||||
#include <testSimulation.hpp>
|
||||
|
||||
static Grid setupSimulation() {
|
||||
int row = 11;
|
||||
@ -58,10 +58,10 @@ static Grid setupSimulation() {
|
||||
}
|
||||
|
||||
TEST_CASE("equality to reference matrix") {
|
||||
fs::path p = fs::current_path(); // .parent_path().parent_path();
|
||||
string test_path = p.generic_string() + "/FTCS_11_11_7000.csv";
|
||||
// set string from the header file
|
||||
string test_path = testSimulationCSVDir;
|
||||
MatrixXd reference = CSV2Eigen(test_path);
|
||||
cout << test_path << endl;
|
||||
Grid grid = setupSimulation();
|
||||
CHECK(checkSimilarity(reference, grid.getConcentrations(), 0.1) == true);
|
||||
}
|
||||
}
|
||||
|
||||
7
test/testSimulation.hpp.in
Normal file
7
test/testSimulation.hpp.in
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef TESTSIMULATION_H_
|
||||
#define TESTSIMULATION_H_
|
||||
|
||||
// CSV file needed for validation
|
||||
const char *testSimulationCSVDir = "@testSimulationCSV@";
|
||||
|
||||
#endif // TESTSIMULATION_H_
|
||||
Loading…
x
Reference in New Issue
Block a user