Update tests
This commit is contained in:
@@ -477,6 +477,7 @@ namespace OpenVulkano
|
|||||||
else
|
else
|
||||||
return (Parent::head = (Parent::HeadId() + 1) % Capacity());
|
return (Parent::head = (Parent::HeadId() + 1) % Capacity());
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~RingBuffer() { Parent::Clear(); }
|
~RingBuffer() { Parent::Clear(); }
|
||||||
|
|
||||||
|
|||||||
@@ -109,10 +109,20 @@ TEST_CASE("Index-based Access and Wraparound", "[RingBuffer]") {
|
|||||||
REQUIRE(buf[1] == 2);
|
REQUIRE(buf[1] == 2);
|
||||||
REQUIRE(buf[2] == 3);
|
REQUIRE(buf[2] == 3);
|
||||||
|
|
||||||
buf.PopBack(); // Remove 1
|
buf.PopBack();
|
||||||
buf.Push(4); // Overwrites oldest (2)
|
buf.Push(4);
|
||||||
|
|
||||||
REQUIRE(buf[0] == 2); // Wrap-around behavior depends on ring position
|
REQUIRE(buf[0] == 2);
|
||||||
|
REQUIRE(buf[1] == 3);
|
||||||
|
REQUIRE(buf[2] == 4);
|
||||||
|
|
||||||
|
// Test full wraparound
|
||||||
|
buf.Push(5);
|
||||||
|
buf.Push(6);
|
||||||
|
|
||||||
|
REQUIRE(buf[0] == 4);
|
||||||
|
REQUIRE(buf[1] == 5);
|
||||||
|
REQUIRE(buf[2] == 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("Emplace and EmplaceBack/Front work correctly", "[RingBuffer]") {
|
TEST_CASE("Emplace and EmplaceBack/Front work correctly", "[RingBuffer]") {
|
||||||
|
|||||||
Reference in New Issue
Block a user