stuff-from-scratch/test/core/TestDataStructures.cpp
2022-11-30 18:28:50 +00:00

34 lines
755 B
C++

#include "CircleBuffer.h"
#include "TestFramework.h"
#include <iostream>
TEST_CASE(TestCircleBuffer, "core")
{
CircleBuffer<unsigned> buffer(3);
for (auto item : {1, 2, 3})
{
//std::cout << "Add item: " << item << std::endl;
buffer.addItem(item);
}
for (std::size_t idx=0; idx<3; idx++)
{
auto item = buffer.getItem(idx);
//std::cout << "Got item: " << idx << " " << item << std::endl;
}
for (auto item : {4, 5})
{
//std::cout << "Add item: " << item << std::endl;
//buffer.addItem(item);
}
for (std::size_t idx=0; idx<3; idx++)
{
auto item = buffer.getItem(idx);
//std::cout << "Got item: " << idx << " " << item << std::endl;
}
}