summaryrefslogtreecommitdiff
path: root/test/test-glAllocator.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2026-03-07 11:42:46 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2026-03-07 11:42:46 +0000
commitc89a633f59d0e393695c10f28c4ba8635eadffba (patch)
tree0e06a281efc2da637ebc19dca38f160e86516d9f /test/test-glAllocator.cpp
parentRemove VertexArrayObject and supporting non-DSA gl_traits helpers (diff)
downloadilt-c89a633f59d0e393695c10f28c4ba8635eadffba.tar.bz2
ilt-c89a633f59d0e393695c10f28c4ba8635eadffba.tar.xz
ilt-c89a633f59d0e393695c10f28c4ba8635eadffba.zip
Replace glContainer with glAllocator
glContainer is no longer required, as we can use std::vector with a custom allocator which uses OpenGL buffers for storage. Minor irritation is that the mapped buffers aren't guaranteed to be flushed in the tests, so sometimes we're missing bits in a test render.
Diffstat (limited to 'test/test-glAllocator.cpp')
-rw-r--r--test/test-glAllocator.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/test-glAllocator.cpp b/test/test-glAllocator.cpp
new file mode 100644
index 0000000..96457a2
--- /dev/null
+++ b/test/test-glAllocator.cpp
@@ -0,0 +1,28 @@
+#define BOOST_TEST_MODULE glAllocator
+
+#include "testMainWindow.h"
+#include <boost/test/data/test_case.hpp>
+#include <boost/test/unit_test.hpp>
+
+#include "glAllocator.h"
+
+BOOST_GLOBAL_FIXTURE(TestMainWindowAppBase);
+
+namespace {
+ BOOST_AUTO_TEST_CASE(Simple)
+ {
+ GLuint name = 0;
+ {
+ glVector<long double> list;
+ BOOST_REQUIRE_EQUAL(list.get_allocator().getNameFor(list), 0);
+ list.reserve(5);
+ name = list.get_allocator().getNameFor(list);
+ BOOST_REQUIRE_GT(name, 0);
+ std::ranges::copy(std::views::iota(0, 10), std::back_inserter(list));
+ BOOST_REQUIRE_EQUAL(10, list.size());
+ BOOST_CHECK_EQUAL(0, list.front());
+ BOOST_CHECK_EQUAL(9, list.back());
+ }
+ BOOST_CHECK(!glIsBuffer(name));
+ }
+}