diff options
| -rw-r--r-- | libs/kstd/kstd/ring_buffer.hpp | 20 | ||||
| -rw-r--r-- | libs/kstd/kstd/ring_buffer.tests.cpp | 17 |
2 files changed, 37 insertions, 0 deletions
diff --git a/libs/kstd/kstd/ring_buffer.hpp b/libs/kstd/kstd/ring_buffer.hpp new file mode 100644 index 00000000..0ceb634d --- /dev/null +++ b/libs/kstd/kstd/ring_buffer.hpp @@ -0,0 +1,20 @@ +#ifndef KSTD_RING_BUFFER_HPP +#define KSTD_RING_BUFFER_HPP + +#include <cstddef> + +namespace kstd +{ + + //! A fixed-size buffer that will overwrite elements in an LRU manner when full. + //! + //! @tparam ValueType The type of the values contained in this ring buffer. + //! @tparam Capacity The maximum number of elements this ring buffer can hold. + template<typename ValueType, std::size_t Capacity> + struct ring_buffer + { + }; + +} // namespace kstd + +#endif
\ No newline at end of file diff --git a/libs/kstd/kstd/ring_buffer.tests.cpp b/libs/kstd/kstd/ring_buffer.tests.cpp new file mode 100644 index 00000000..3608d5ce --- /dev/null +++ b/libs/kstd/kstd/ring_buffer.tests.cpp @@ -0,0 +1,17 @@ +#include <kstd/ring_buffer.hpp> + +#include <catch2/catch_test_macros.hpp> + +#include <tuple> + +SCENARIO("Ring Buffer initialization and construction", "[ring_buffer]") +{ + GIVEN("An empty context") + { + WHEN("constructing by default") + { + auto buffer = kstd::ring_buffer<int, 5>{}; + std::ignore = buffer; + } + } +}
\ No newline at end of file |
