From 6e3e64671cbf33cbf050a2f5c577e13e5851b27f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 5 Nov 2023 21:30:17 +0100 Subject: wip --- test/CMakeLists.txt | 1 - test/json/frameset-header.json | 9 --------- test/json/frameset-header2.json | 9 --------- test/json/wall-atlas-header1.json | 9 +++++++++ test/wall-atlas.cpp | 33 ++++++++++++++------------------- 5 files changed, 23 insertions(+), 38 deletions(-) delete mode 100644 test/json/frameset-header.json delete mode 100644 test/json/frameset-header2.json create mode 100644 test/json/wall-atlas-header1.json diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 897268f3..8473f091 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -21,7 +21,6 @@ endif() fm_add_install_executable(${self}) set(save-dir "${CMAKE_BINARY_DIR}/test/save") -file(REMOVE_RECURSE "${save-dir}") file(GLOB files "save/*.dat" CONFIGURE_ARGS) foreach(file ${files}) install(FILES "${file}" DESTINATION "${save-dir}") diff --git a/test/json/frameset-header.json b/test/json/frameset-header.json deleted file mode 100644 index 8b32cabc..00000000 --- a/test/json/frameset-header.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "foo", - "depth": 42, - "framesets": { - "w": {}, - "n": {} - }, - "frames": [] -} diff --git a/test/json/frameset-header2.json b/test/json/frameset-header2.json deleted file mode 100644 index 8b32cabc..00000000 --- a/test/json/frameset-header2.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "foo", - "depth": 42, - "framesets": { - "w": {}, - "n": {} - }, - "frames": [] -} diff --git a/test/json/wall-atlas-header1.json b/test/json/wall-atlas-header1.json new file mode 100644 index 00000000..8b32cabc --- /dev/null +++ b/test/json/wall-atlas-header1.json @@ -0,0 +1,9 @@ +{ + "name": "foo", + "depth": 42, + "framesets": { + "w": {}, + "n": {} + }, + "frames": [] +} diff --git a/test/wall-atlas.cpp b/test/wall-atlas.cpp index b9ba2aec..9fbd4579 100644 --- a/test/wall-atlas.cpp +++ b/test/wall-atlas.cpp @@ -7,25 +7,21 @@ #include #include -namespace floormat { +namespace floormat::Wall::detail { using nlohmann::json; namespace { -[[nodiscard]] Pair test_atlas_header(StringView path, StringView filename) +void test_atlas_header(StringView path, StringView filename) { - auto j = json_helper::from_json_(Path::join(path, filename)); - wall_atlas_def def; - test::read_atlas_header(j, def); + auto jroot = json_helper::from_json_(Path::join(path, filename)); + auto info = read_info_header(jroot); - fm_assert(def.info.name == "foo"_s); - fm_assert(def.info.depth == 42); - fm_assert(def.dir_count == 2); - - constexpr auto none = (uint8_t)-1; - enum : uint8_t { N, E, S, W, }; + fm_assert(info.name == "foo"_s); + fm_assert(info.depth == 42); +#if 0 fm_assert(def.dir_indexes[N] == 0 || def.dir_indexes[N] == 1); fm_assert(def.dir_indexes[E] == none); fm_assert(def.dir_indexes[S] == none); @@ -36,21 +32,20 @@ namespace { fm_assert(def.dir_indexes[W] == 0); else fm_assert(false); - - return {std::move(def), std::move(j)}; +#endif } } // namespace -void test_app::test_wall_atlas() +} // namespace floormat::Wall::detail + +void floormat::test_app::test_wall_atlas() { + using namespace floormat::Wall::detail; + fm_assert(Path::exists(Path::join(loader.TEMP_PATH, "CMakeCache.txt"))); const auto path = Path::join(loader.TEMP_PATH, "test/json"_s); fm_assert(Path::isDirectory(path)); - (void)test_atlas_header(path, "frame_direction-header.json"_s); + (void)test_atlas_header(path, "wall-atlas-header1.json"_s); } - - - -} // namespace floormat -- cgit v1.2.3