feat(data): SPSC ring buffer, incremental min/max LOD pyramid, series types
This commit is contained in:
1 parent
c93c98002b
commit
138fa478c3
15 files changed
+1182
-8
No files matched your search
@@ -0,0 +1,19 @@
|
||||
#include "harness.hpp"
|
||||
#include <plot/data/ring_buffer.hpp>
|
||||
|
||||
PLOT_TEST(ring_wraps_and_keeps_latest) {
|
||||
plot::data::RingBuffer<f32> r(8); // capacity rounded up to a power of two
|
||||
for (int i = 0; i < 20; ++i) r.push(f32(i));
|
||||
PLOT_CHECK(r.size() == 8);
|
||||
PLOT_CHECK_NEAR(r[0], 12.0); // oldest retained
|
||||
PLOT_CHECK_NEAR(r[7], 19.0); // newest
|
||||
}
|
||||
PLOT_TEST(ring_clear_resets) {
|
||||
plot::data::RingBuffer<f32> r(8);
|
||||
for (int i = 0; i < 5; ++i) r.push(f32(i));
|
||||
r.clear();
|
||||
PLOT_CHECK(r.size() == 0);
|
||||
r.push(42.0f);
|
||||
PLOT_CHECK(r.size() == 1);
|
||||
PLOT_CHECK_NEAR(r[0], 42.0);
|
||||
}
|
||||
Reference in new issue
Block a user