A round of new universal capabilities (all generic — templated/reflection based, no app coupling), verified by the test suite (1103 passing): Data reflection: - Reflect.hpp now (de)serializes chrono::duration, chrono::time_point, std::variant (tagged), std::array, and non-string-keyed std::map; Meta.hpp gains is_time_point_v et al. Async: - EventBus gains Mode::Async (worker-thread dispatch + flush()). - ThreadPool gains a bounded queue, try_submit(), and rejection stats. New modules / containers: - Resilience: TokenBucket, KeyedRateLimiter<Key>, CircuitBreaker, ResourceMonitor. - Containers: BufferPool<T> (size-class buffer reuse) and Cache<K,V> (per-entry TTL, LRU/LFU/FIFO eviction, hit/miss stats). - System: process/CPU/memory metrics (Metrics.hpp) and a streaming Process API. Plus FSM v2 (typed Success/Failure, sub-machines, parallel regions, history states, deferred events), Configuration/Logging reflection helpers, and the accompanying test suites. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
41 lines
1.0 KiB
C++
41 lines
1.0 KiB
C++
#include <Void/Data/Csv.hpp>
|
|
#include <Void/Testing/Assert.hpp>
|
|
#include <Void/Testing/Test.hpp>
|
|
|
|
#include <string>
|
|
|
|
namespace
|
|
{
|
|
struct Rec {
|
|
std::string name = "";
|
|
int age = 0;
|
|
double score = 0;
|
|
bool ok = false;
|
|
};
|
|
} // namespace
|
|
|
|
// @tag reflection
|
|
Void::Testing::Test csv_header_and_to_row()
|
|
{
|
|
const auto h = Void::Csv::header_row<Rec>();
|
|
Void::Testing::expect_eq(h.size(), std::size_t{4});
|
|
Void::Testing::expect(h[0] == "name" && h[1] == "age" && h[3] == "ok");
|
|
|
|
Rec r{"neo", 30, 9.5, true};
|
|
const auto row = Void::Csv::to_row(r);
|
|
Void::Testing::expect(row[0] == "neo" && row[1] == "30" &&
|
|
row[3] == "true");
|
|
}
|
|
|
|
// @tag reflection
|
|
Void::Testing::Test csv_from_row_round_trip()
|
|
{
|
|
Rec r{"trin", 28, 7.25, false};
|
|
const auto back = Void::Csv::from_row<Rec>(Void::Csv::to_row(r));
|
|
Void::Testing::expect(back.has_value());
|
|
Void::Testing::expect_eq(back->name, std::string{"trin"});
|
|
Void::Testing::expect_eq(back->age, 28);
|
|
Void::Testing::expect(back->score > 7.2 && back->score < 7.3);
|
|
Void::Testing::expect_eq(back->ok, false);
|
|
}
|