Wildmeshing Toolkit
Loading...
Searching...
No Matches
test_component_mesh_info.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#include <wmtk/io/Cache.hpp>
7
8using namespace wmtk::components::utils;
9
10using json = nlohmann::json;
11
12const std::filesystem::path data_dir = WMTK_DATA_DIR;
13
14TEST_CASE("component_mesh_info", "[components][mesh_info]")
15{
16 wmtk::io::Cache cache("wmtk_cache", ".");
17
18 const std::filesystem::path input_file = data_dir / "small.msh";
19
20 json input_component_json = {
21 {"type", "input"},
22 {"name", "input_mesh"},
23 {"file", input_file.string()},
24 {"ignore_z", false},
25 {"tetrahedron_attributes", json::array()}};
26
27
28 wmtk::components::input(Paths(), input_component_json, cache);
29
30
31 SECTION("should pass")
32 {
33 json mesh_info_component_json = {{"type", "mesh_info"}, {"input", "input_mesh"}};
34 CHECK_NOTHROW(wmtk::components::mesh_info(Paths(), mesh_info_component_json, cache));
35 }
36
37 SECTION("should throw")
38 {
39 json mesh_info_component_json = {
40 {"type", "mesh_info"},
41 {"input", "In case you ever name your file like that: What is wrong with you?"}};
42
43 CHECK_THROWS(wmtk::components::mesh_info(Paths(), mesh_info_component_json, cache));
44 }
45}
void mesh_info(const utils::Paths &paths, const nlohmann::json &j, io::Cache &cache)
Definition mesh_info.cpp:11
const std::filesystem::path data_dir
TEST_CASE("component_mesh_info", "[components][mesh_info]")
nlohmann::json json
Definition input.cpp:9