| 30 | using namespace oid::host; |
| 31 | |
| 32 | TEST(MergePreviousBuffers, LoadedGetFreshExpiryDeletedDropped) { |
| 33 | std::vector<PreviousBuffer> prior = { |
| 34 | {"a", 5}, {"gone", 999999}, {"stale", 1}}; |
| 35 | std::vector<std::string> loaded = {"a"}; // only "a" loaded now |
| 36 | std::set<std::string, std::less<>> seen = { |
| 37 | "a", "gone"}; // "gone" was loaded then removed |
| 38 | const auto out = |
| 39 | merge_previous_buffers(prior, loaded, seen, /*now*/ 100, /*ttl*/ 50); |
| 40 | // "a": loaded -> fresh expiry 150; "gone": seen+absent -> dropped; |
| 41 | // "stale": not seen but expired (1<100) -> dropped. |
| 42 | ASSERT_EQ(out.size(), 1u); |
| 43 | EXPECT_EQ(out[0].variable_name, "a"); |
| 44 | EXPECT_EQ(out[0].expiry_epoch_s, 150); |
| 45 | } |
| 46 | |
| 47 | TEST(MergePreviousBuffers, NotYetReloadedUnexpiredSurvives) { |
| 48 | std::vector<PreviousBuffer> prior = {{"later", 1000}}; |
nothing calls this directly
no test coverage detected