52 std::vector<InputChannelInfo> infos{1};
58 context.
put({0, uint64_t{10}});
60 auto [action, slot] =
index.replaceLRUWith(context, {10});
61 REQUIRE(slot.index == 0);
62 REQUIRE(action == TimesliceIndex::ActionTaken::ReplaceUnused);
65 context.
put({0, uint64_t{20}});
67 auto [action, slot] =
index.replaceLRUWith(context, {20});
68 REQUIRE(slot.index == 1);
69 REQUIRE(action == TimesliceIndex::ActionTaken::ReplaceUnused);
72 context.
put({0, uint64_t{30}});
74 auto [action, slot] =
index.replaceLRUWith(context, {30});
75 REQUIRE(slot.index == 2);
76 REQUIRE(action == TimesliceIndex::ActionTaken::ReplaceUnused);
79 context.
put({0, uint64_t{40}});
81 auto [action, slot] =
index.replaceLRUWith(context, {40});
82 REQUIRE(slot.index == TimesliceSlot::INVALID);
83 REQUIRE(action == TimesliceIndex::ActionTaken::Wait);
86 context.
put({0, uint64_t{50}});
88 auto [action, slot] =
index.replaceLRUWith(context, {50});
89 REQUIRE(slot.index == TimesliceSlot::INVALID);
90 REQUIRE(action == TimesliceIndex::ActionTaken::Wait);
93 context.
put({0, uint64_t{10}});
95 auto [action, slot] =
index.replaceLRUWith(context, {10});
96 REQUIRE(slot.index == TimesliceSlot::INVALID);
97 REQUIRE(action == TimesliceIndex::ActionTaken::Wait);
106 std::vector<InputChannelInfo> infos{2};
113 context.
put({0, uint64_t{9}});
115 auto [action, slot] =
index.replaceLRUWith(context, {9});
116 index.markAsDirty(slot,
true);
117 auto oldest =
index.setOldestPossibleInput({9}, {0});
118 for (
size_t i = 0;
i < 3; ++
i) {
120 INFO(
"Slot " <<
i <<
" valid: " << invalidated);
122 index.updateOldestPossibleOutput(
false);
123 REQUIRE(slot.index == 1);
124 REQUIRE(action == TimesliceIndex::ActionTaken::ReplaceUnused);
127 context.
put({0, uint64_t{10}});
129 auto [action, slot] =
index.replaceLRUWith(context, {10});
130 index.markAsDirty(slot,
true);
131 auto oldest =
index.setOldestPossibleInput({10}, {1});
132 for (
size_t i = 0;
i < 3; ++
i) {
135 REQUIRE(slot.index == 0);
136 REQUIRE(action == TimesliceIndex::ActionTaken::ReplaceUnused);
139 REQUIRE(
index.getOldestPossibleInput().timeslice.value == 9);
140 REQUIRE(
index.getOldestPossibleOutput().timeslice.value == 0);
141 auto oldest =
index.setOldestPossibleInput({10}, {0});
142 for (
size_t i = 0;
i < 3; ++
i) {
145 index.updateOldestPossibleOutput(
false);
146 REQUIRE(
index.getOldestPossibleInput().timeslice.value == 10);
147 REQUIRE(
index.getOldestPossibleOutput().timeslice.value == 9);
148 oldest =
index.setOldestPossibleInput({11}, {1});
149 for (
size_t i = 0;
i < 3; ++
i) {
152 index.updateOldestPossibleOutput(
false);
153 REQUIRE(
index.getOldestPossibleInput().timeslice.value == 10);
154 REQUIRE(
index.getOldestPossibleOutput().timeslice.value == 9);
156 index.markAsDirty({1},
false);
157 index.updateOldestPossibleOutput(
false);
158 REQUIRE(
index.getOldestPossibleOutput().timeslice.value == 9);
159 index.markAsInvalid({1});
160 index.updateOldestPossibleOutput(
false);
161 REQUIRE(
index.getOldestPossibleOutput().timeslice.value == 10);
void put(ContextUpdate &&update)