Wildmeshing Toolkit
Loading...
Searching...
No Matches
test_component_export_cache.cpp
Go to the documentation of this file.
1#include <catch2/catch_test_macros.hpp>
2#include <nlohmann/json.hpp>
5#include <wmtk/components/utils/Paths.hpp>
6
7using namespace wmtk::components::utils;
8using json = nlohmann::json;
9
10const std::filesystem::path data_dir = WMTK_DATA_DIR;
11
12TEST_CASE("component_export_cache", "[components][export_cache]")
13{
14 wmtk::io::Cache cache("wmtk_cache", ".");
15
16 // input
17 {
18 const std::filesystem::path input_file = data_dir / "small.msh";
19 json component_json = {
20 {"name", "input_mesh"},
21 {"file", input_file.string()},
22 {"ignore_z", false},
23 {"tetrahedron_attributes", json::array()}};
24
25
26 CHECK_NOTHROW(wmtk::components::input(Paths(), component_json, cache));
27 }
28
29 wmtk::io::Cache cache_dump("wmtk_dump", ".");
30
31 // export cache
32 {
33 json o;
34 o["folder"] = cache_dump.get_cache_path() / "exported_cache";
35
36 CHECK_NOTHROW(wmtk::components::export_cache(Paths(), o, cache));
37 }
38}
std::filesystem::path get_cache_path() const
Get the path of the cache folder.
Definition Cache.cpp:146
void export_cache(const utils::Paths &paths, const nlohmann::json &j, io::Cache &cache)
const std::filesystem::path data_dir
TEST_CASE("component_export_cache", "[components][export_cache]")
nlohmann::json json
Definition input.cpp:9