Added support for std::chrono::duration; fixes #399

This commit is contained in:
Dr. Patrick Urbanke (劉自成)
2025-04-14 00:15:26 +08:00
committed by GitHub
parent 15742a8739
commit ef0b0b4729
7 changed files with 232 additions and 5 deletions
+19
View File
@@ -0,0 +1,19 @@
#include <chrono>
#include <iostream>
#include <rfl.hpp>
#include <rfl/json.hpp>
#include <vector>
#include "write_and_read.hpp"
namespace test_duration {
struct TestStruct {
std::chrono::seconds duration;
};
TEST(json, test_duration) {
const auto test = TestStruct{.duration = std::chrono::seconds(10)};
write_and_read(test, R"({"duration":{"count":10,"unit":"seconds"}})");
}
} // namespace test_duration