mirror of
https://codeberg.org/DawnMagnet/reflect-cpp
synced 2026-12-06 10:46:18 +08:00
Added support for std::chrono::duration; fixes #399
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user