test: add additional tests around swapping and iterators

This commit is contained in:
Ferdi265 committed 2025-05-12 15:30:46 +02:00
1 parent ab1a477757
commit 010362d1f6
3 files changed
+101

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
#include <vector>
#include <cassert>
#include <ring-buffer.h>
#include <utility>
int main() {
ring_buffer<int, 4> buf1;
buf1.push_back(1);
buf1.push_back(2);
buf1.push_back(3);
buf1.push_back(4);
buf1.push_back(5);
buf1.push_back(6);
ring_buffer<int, 4> buf2;
buf2.push_back(10);
buf2.push_back(20);
buf2.push_back(30);
buf2.push_back(40);
buf2.push_back(50);
buf2.push_back(60);
auto it1 = buf1.begin();
auto it2 = buf2.begin();
std::swap(it1, it2);
{
assert(*it1 == 30);
assert(*it2 == 3);
}
}