Make all Literal default-constructible; fixes #536 (#539)

This commit is contained in:
Dr. Patrick Urbanke (劉自成)
2025-11-03 22:47:19 +01:00
committed by GitHub
parent e47dfbeb1f
commit 920caef563
2 changed files with 19 additions and 4 deletions
+19
View File
@@ -0,0 +1,19 @@
#include <chrono>
#include <rfl.hpp>
#include <rfl/json.hpp>
#include "rfl/DefaultIfMissing.hpp"
#include "write_and_read.hpp"
namespace test_duration_default {
struct TestStruct {
std::chrono::seconds duration;
};
TEST(json, test_duration_default) {
const auto test = TestStruct{.duration = std::chrono::seconds(10)};
write_and_read<rfl::DefaultIfMissing>(
test, R"({"duration":{"count":10,"unit":"seconds"}})");
}
} // namespace test_duration_default