summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-10-06 18:24:20 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-10-06 18:24:20 +0200
commit84d091346a9fdf26f5dca2cc49a1c592f40fcd05 (patch)
tree700d5ada6e4f72f545e9019bb848c47e4483ec49
parent906c4f794e02904325cd61124e41d8868e78d3fa (diff)
a
-rw-r--r--serialize/json-helper.hpp1
-rw-r--r--test/CMakeLists.txt3
-rw-r--r--test/json.cpp4
3 files changed, 6 insertions, 2 deletions
diff --git a/serialize/json-helper.hpp b/serialize/json-helper.hpp
index 4a9ee0ac..345efe54 100644
--- a/serialize/json-helper.hpp
+++ b/serialize/json-helper.hpp
@@ -45,6 +45,7 @@ bool json_helper::to_json(const t& self, const std::filesystem::path& pathname)
return false;
}
s << j.dump(4);
+ s << '\n';
s.flush();
return true;
}
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 2bec4a7c..ec7078cb 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,8 +1,11 @@
set(self "${PROJECT_NAME}-test")
file(GLOB sources "*.cpp" CONFIGURE_ARGS)
+file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/test")
+
link_libraries(${PROJECT_NAME})
link_libraries(Magnum::Application Magnum::Trade)
add_executable(${self} "${sources}" "../main/loader-impl.cpp")
install(TARGETS ${self} RUNTIME DESTINATION bin)
+
diff --git a/test/json.cpp b/test/json.cpp
index 51bc6f80..dfcbd23f 100644
--- a/test/json.cpp
+++ b/test/json.cpp
@@ -11,7 +11,7 @@ void app::test_json() // NOLINT(readability-convert-member-functions-to-static)
{
bool ret = true;
using nlohmann::to_json;
- const std::filesystem::path output_dir = "f:/dev/game/build/test/";
+ const std::filesystem::path output_dir = "../test/";
{
nlohmann::json j;
auto atlas = loader.tile_atlas("share/game/images/metal1.tga", {2, 2});
@@ -19,7 +19,7 @@ void app::test_json() // NOLINT(readability-convert-member-functions-to-static)
}
{
Magnum::Math::Vector<2, int> v2i_1{1, 2};
- Vector2 v2i_2{2, 3};
+ Vector2i v2i_2{2, 3};
ret &= json_helper::to_json(v2i_1, output_dir/"vec2i_1.json");
ret &= json_helper::to_json(v2i_2, output_dir/"vec2i_2.json");
}