summaryrefslogtreecommitdiff
path: root/test
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
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')
-rw-r--r--test/Jamfile.jam8
-rw-r--r--test/test-glAllocator.cpp28
-rw-r--r--test/test-glContainer.cpp453
-rw-r--r--test/test-instancing.cpp33
4 files changed, 41 insertions, 481 deletions
diff --git a/test/Jamfile.jam b/test/Jamfile.jam
index a96ca2a..da2a61a 100644
--- a/test/Jamfile.jam
+++ b/test/Jamfile.jam
@@ -61,9 +61,9 @@ run test-lib.cpp ;
run [ glob test-geoData*.cpp ] : -- : [ sequence.insertion-sort [ glob-tree $(fixtures)/geoData : *.json ] fixtures/height/SD19.asc ] : <library>test ;
run test-network.cpp : : : <library>test ;
run test-persistence.cpp : -- : [ sequence.insertion-sort [ glob-tree $(fixtures)/json : *.json ] ] : <library>test ;
-run test-text.cpp : -- : test-glContainer : <library>test ;
+run test-text.cpp : -- : test-glAllocator : <library>test ;
run test-enumDetails.cpp ;
-run test-render.cpp : -- : test-assetFactory : <library>test ;
+run test-render.cpp : -- : : <library>test ;
run test-glContextBhvr.cpp ;
run test-assetFactory.cpp : -- : [ sequence.insertion-sort [ glob-tree $(res) : *.* ] fixtures/rgb.txt test-instancing ] : <library>test ;
perfrun perf-assetFactory.cpp : : test-assetFactory ;
@@ -71,9 +71,9 @@ perfrun perf-geoData.cpp : : test-geoData ;
perfrun perf-terrain.cpp : : test-geoData ;
perfrun perf-persistence.cpp : : test-persistence ;
run test-worker.cpp ;
-run test-instancing.cpp : -- : test-glContainer : <library>test ;
+run test-instancing.cpp : -- : test-glAllocator : <library>test ;
perfrun perf-instancing.cpp : : test-instancing ;
-run test-glContainer.cpp : : : <library>test ;
+run test-glAllocator.cpp : : : <library>test ;
run test-pack.cpp : : : <library>test ;
run test-environment.cpp : : : <library>test ;
run test-ui.cpp : : : <library>test ;
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));
+ }
+}
diff --git a/test/test-glContainer.cpp b/test/test-glContainer.cpp
deleted file mode 100644
index 7f82e13..0000000
--- a/test/test-glContainer.cpp
+++ /dev/null
@@ -1,453 +0,0 @@
-#define BOOST_TEST_MODULE glContainer
-
-#include "testMainWindow.h"
-#include <boost/test/data/test_case.hpp>
-#include <boost/test/unit_test.hpp>
-
-#include "glContainer.h"
-
-// Force generation of all functions
-template class glContainer<int>;
-
-BOOST_TEST_DONT_PRINT_LOG_VALUE(glContainer<int>::iterator);
-BOOST_TEST_DONT_PRINT_LOG_VALUE(glContainer<int>::const_iterator);
-BOOST_TEST_DONT_PRINT_LOG_VALUE(glContainer<int>::reverse_iterator);
-BOOST_TEST_DONT_PRINT_LOG_VALUE(glContainer<int>::const_reverse_iterator);
-
-BOOST_GLOBAL_FIXTURE(TestMainWindowAppBase);
-
-BOOST_FIXTURE_TEST_SUITE(i, glContainer<int>)
-
-BOOST_AUTO_TEST_CASE(CreateDestroy, *boost::unit_test::timeout(1))
-{
- // Unmapped
- BOOST_CHECK(!data_);
- BOOST_CHECK(!access_);
- // Request map, but empty
- BOOST_CHECK_NO_THROW(map(GL_READ_ONLY));
- BOOST_REQUIRE(!data_);
- BOOST_REQUIRE(!access_);
- BOOST_CHECK_NO_THROW(map(GL_READ_WRITE));
- BOOST_REQUIRE(!data_);
- BOOST_REQUIRE(!access_);
- // Add something
- BOOST_CHECK_NO_THROW(emplace_back(0));
- BOOST_REQUIRE(data_);
- BOOST_REQUIRE_EQUAL(access_, GL_READ_WRITE);
- // Unmap
- BOOST_CHECK_NO_THROW(unmap());
- BOOST_REQUIRE(!data_);
- BOOST_REQUIRE(!access_);
- // Map RO
- BOOST_CHECK_NO_THROW(map(GL_READ_ONLY));
- BOOST_REQUIRE(data_);
- BOOST_REQUIRE_EQUAL(access_, GL_READ_ONLY);
- // Map RW upgradde
- BOOST_CHECK_NO_THROW(map(GL_READ_WRITE));
- BOOST_REQUIRE(data_);
- BOOST_REQUIRE_EQUAL(access_, GL_READ_WRITE);
- // Map RO downgradde, no change
- BOOST_CHECK_NO_THROW(map(GL_READ_ONLY));
- BOOST_REQUIRE(data_);
- BOOST_REQUIRE_EQUAL(access_, GL_READ_WRITE);
- // Unmap
- BOOST_CHECK_NO_THROW(unmap());
- BOOST_CHECK(!data_);
- BOOST_CHECK(!access_);
-}
-
-BOOST_AUTO_TEST_CASE(MapModes)
-{
- BOOST_CHECK_EQUAL(std::accumulate(begin(), end(), 0), 0);
- BOOST_CHECK(!data_);
- BOOST_CHECK(!access_);
-
- BOOST_CHECK_NO_THROW(push_back(1));
- BOOST_CHECK_NO_THROW(push_back(2));
- BOOST_CHECK_NO_THROW(push_back(3));
- BOOST_CHECK_NO_THROW(push_back(4));
- BOOST_CHECK_NO_THROW(unmap());
-
- BOOST_CHECK_EQUAL(std::accumulate(cbegin(), cend(), 0), 10);
- BOOST_CHECK(data_);
- BOOST_CHECK_EQUAL(access_, GL_READ_ONLY);
- BOOST_CHECK_NO_THROW(unmap());
-
- BOOST_CHECK_EQUAL(std::accumulate(begin(), end(), 0), 10);
- BOOST_CHECK(data_);
- BOOST_CHECK_EQUAL(access_, GL_READ_WRITE);
- BOOST_CHECK_NO_THROW(unmap());
-
- BOOST_CHECK_EQUAL(std::ranges::fold_left(std::as_const(*this), 0, std::plus {}), 10);
- BOOST_CHECK(data_);
- BOOST_CHECK_EQUAL(access_, GL_READ_ONLY);
- BOOST_CHECK_NO_THROW(unmap());
-}
-
-BOOST_AUTO_TEST_CASE(PushBackTest, *boost::unit_test::timeout(1))
-{
- BOOST_CHECK_EQUAL(capacity_, 1);
- BOOST_CHECK_EQUAL(size_, 0);
- BOOST_CHECK_NO_THROW(push_back(1));
- BOOST_CHECK_NO_THROW(push_back(2));
- BOOST_CHECK_NO_THROW(push_back(3));
- BOOST_CHECK_NO_THROW(push_back(4));
- BOOST_CHECK_NO_THROW(push_back(5));
- BOOST_CHECK_EQUAL(capacity_, 8);
- BOOST_CHECK_EQUAL(size_, 5);
- {
- std::array expected1 {1, 2, 3, 4, 5};
- BOOST_CHECK_EQUAL_COLLECTIONS(begin(), end(), expected1.begin(), expected1.end());
- BOOST_CHECK_EQUAL_COLLECTIONS(rbegin(), rend(), expected1.rbegin(), expected1.rend());
- }
-}
-
-BOOST_AUTO_TEST_CASE(EmplaceBackTest, *boost::unit_test::timeout(1))
-{
- BOOST_CHECK_EQUAL(capacity_, 1);
- BOOST_CHECK_EQUAL(size_, 0);
-
- BOOST_CHECK_NO_THROW(emplace_back(1));
- BOOST_CHECK_NO_THROW(emplace_back(2));
- BOOST_CHECK_EQUAL(capacity_, 2);
- BOOST_CHECK_EQUAL(size_, 2);
-
- BOOST_CHECK_NO_THROW(reserve(5));
- BOOST_CHECK_EQUAL(capacity_, 5);
- BOOST_CHECK_EQUAL(size_, 2);
-
- BOOST_CHECK_NO_THROW(emplace_back(3));
- BOOST_CHECK_NO_THROW(emplace_back(4));
- BOOST_CHECK_EQUAL(capacity_, 5);
- BOOST_CHECK_EQUAL(size_, 4);
-
- {
- std::array expected1 {1, 2, 3, 4};
- BOOST_CHECK_EQUAL_COLLECTIONS(begin(), end(), expected1.begin(), expected1.end());
- BOOST_CHECK_EQUAL_COLLECTIONS(rbegin(), rend(), expected1.rbegin(), expected1.rend());
- }
-
- BOOST_CHECK_NO_THROW(emplace_back(5));
- BOOST_CHECK_EQUAL(capacity_, 5);
- BOOST_CHECK_EQUAL(size_, 5);
- BOOST_CHECK_NO_THROW(emplace_back(6));
- BOOST_CHECK_NO_THROW(emplace_back(7));
- BOOST_CHECK_EQUAL(capacity_, 10);
- BOOST_CHECK_EQUAL(size_, 7);
-
- {
- std::array expected2 {1, 2, 3, 4, 5, 6, 7};
- BOOST_CHECK_EQUAL_COLLECTIONS(begin(), end(), expected2.begin(), expected2.end());
- BOOST_CHECK_EQUAL_COLLECTIONS(rbegin(), rend(), expected2.rbegin(), expected2.rend());
- }
-
- BOOST_CHECK_EQUAL(7, end() - begin());
- BOOST_CHECK_EQUAL(7, rend() - rbegin());
-}
-
-BOOST_AUTO_TEST_CASE(ResizeTest)
-{
- BOOST_CHECK_NO_THROW(push_back(1));
- BOOST_CHECK_NO_THROW(emplace_back(2));
- BOOST_CHECK_NO_THROW(resize(4));
- BOOST_CHECK_EQUAL(capacity_, 4);
- BOOST_CHECK_EQUAL(size_, 4);
- {
- std::array expected1 {1, 2, 0, 0};
- BOOST_CHECK_EQUAL_COLLECTIONS(begin(), end(), expected1.begin(), expected1.end());
- }
-
- BOOST_CHECK_NO_THROW(resize(1));
- BOOST_CHECK_EQUAL(capacity_, 1);
- BOOST_CHECK_EQUAL(size_, 1);
- {
- std::array expected2 {1};
- BOOST_CHECK_EQUAL_COLLECTIONS(begin(), end(), expected2.begin(), expected2.end());
- }
-
- BOOST_CHECK_NO_THROW(resize(1));
- BOOST_CHECK_EQUAL(capacity_, 1);
- BOOST_CHECK_EQUAL(size_, 1);
-
- BOOST_CHECK_NO_THROW(resize(0));
- BOOST_CHECK_EQUAL(capacity_, 1);
- BOOST_CHECK_EQUAL(size_, 0);
- BOOST_CHECK_EQUAL(begin(), end());
- BOOST_CHECK_EQUAL(rbegin(), rend());
-}
-
-BOOST_AUTO_TEST_CASE(ShrinkToFitTest)
-{
- BOOST_CHECK_NO_THROW(reserve(4));
- BOOST_CHECK_NO_THROW(emplace_back(1));
- BOOST_CHECK_NO_THROW(emplace_back(2));
- BOOST_CHECK_EQUAL(capacity_, 4);
- BOOST_CHECK_EQUAL(size_, 2);
- {
- std::array expected1 {1, 2};
- BOOST_CHECK_EQUAL_COLLECTIONS(begin(), end(), expected1.begin(), expected1.end());
- }
- BOOST_CHECK_NO_THROW(shrink_to_fit());
- BOOST_CHECK_EQUAL(capacity_, 2);
- BOOST_CHECK_EQUAL(size_, 2);
- {
- std::array expected1 {1, 2};
- BOOST_CHECK_EQUAL_COLLECTIONS(begin(), end(), expected1.begin(), expected1.end());
- }
-
- BOOST_CHECK_NO_THROW(shrink_to_fit());
- BOOST_CHECK_EQUAL(capacity(), 2);
- BOOST_CHECK_EQUAL(size(), 2);
-
- BOOST_CHECK_NO_THROW(clear());
- BOOST_CHECK_EQUAL(capacity(), 2);
- BOOST_CHECK_EQUAL(size(), 0);
-}
-
-BOOST_AUTO_TEST_CASE(Getters)
-{
- BOOST_CHECK(empty());
- BOOST_CHECK_NO_THROW(emplace_back(1));
- BOOST_CHECK(!empty());
- BOOST_CHECK_NO_THROW(emplace_back(2));
- BOOST_CHECK_EQUAL(1, front());
- BOOST_CHECK_EQUAL(2, back());
- BOOST_CHECK_EQUAL(1, at(0));
- BOOST_CHECK_EQUAL(2, at(1));
- BOOST_CHECK_EQUAL(1, (*this)[0]);
- BOOST_CHECK_EQUAL(2, (*this)[1]);
- BOOST_CHECK_EQUAL(data_, data());
- BOOST_CHECK_THROW(std::ignore = at(2), std::out_of_range);
-
- const auto & constCont {*this};
- BOOST_CHECK_EQUAL(1, constCont.front());
- BOOST_CHECK_EQUAL(2, constCont.back());
- {
- std::array expected1 {1, 2};
- BOOST_CHECK_EQUAL_COLLECTIONS(constCont.begin(), constCont.end(), expected1.begin(), expected1.end());
- BOOST_CHECK_EQUAL_COLLECTIONS(constCont.rbegin(), constCont.rend(), expected1.rbegin(), expected1.rend());
- BOOST_CHECK_EQUAL_COLLECTIONS(constCont.cbegin(), constCont.cend(), expected1.cbegin(), expected1.cend());
- BOOST_CHECK_EQUAL_COLLECTIONS(constCont.crbegin(), constCont.crend(), expected1.crbegin(), expected1.crend());
- }
- BOOST_CHECK_EQUAL(1, constCont.at(0));
- BOOST_CHECK_EQUAL(2, constCont.at(1));
- BOOST_CHECK_EQUAL(1, constCont[0]);
- BOOST_CHECK_EQUAL(2, constCont[1]);
- BOOST_CHECK_EQUAL(data_, constCont.data());
- BOOST_CHECK_THROW(std::ignore = constCont.at(2), std::out_of_range);
-}
-
-BOOST_AUTO_TEST_CASE(RandomAccess)
-{
- BOOST_CHECK_NO_THROW(emplace_back(1));
- BOOST_CHECK_NO_THROW(emplace_back(2));
- BOOST_CHECK_NO_THROW(emplace_back(3));
-
- auto iterator = begin();
- BOOST_CHECK_EQUAL(1, *iterator);
- BOOST_CHECK_EQUAL(2, *++iterator);
- BOOST_CHECK_EQUAL(2, *iterator++);
- BOOST_CHECK_EQUAL(3, *iterator);
- BOOST_CHECK_EQUAL(3, *iterator--);
- BOOST_CHECK_EQUAL(2, *iterator);
- BOOST_CHECK_EQUAL(1, *--iterator);
- BOOST_CHECK_EQUAL(1, *iterator);
-}
-
-BOOST_AUTO_TEST_CASE(RandomWrite)
-{
- BOOST_CHECK_NO_THROW(resize(3));
- BOOST_CHECK_EQUAL(size(), 3);
- BOOST_CHECK_NO_THROW(unmap());
- BOOST_REQUIRE(!data_);
- BOOST_CHECK_NO_THROW(at(0, 10));
- BOOST_CHECK_NO_THROW(at(1, 20));
- BOOST_CHECK_NO_THROW(at(2, 30));
- BOOST_CHECK(!data_);
- {
- std::array expected1 {10, 20, 30};
- BOOST_CHECK_EQUAL_COLLECTIONS(begin(), end(), expected1.begin(), expected1.end());
- }
- BOOST_CHECK(data_);
- BOOST_CHECK_NO_THROW(at(1, 40));
- {
- std::array expected1 {10, 40, 30};
- BOOST_CHECK_EQUAL_COLLECTIONS(begin(), end(), expected1.begin(), expected1.end());
- }
- BOOST_CHECK_THROW(at(4, 0), std::out_of_range);
-}
-
-BOOST_AUTO_TEST_CASE(InsertRemoveTest)
-{
- BOOST_CHECK_NO_THROW(emplace_back(1));
- BOOST_CHECK_NO_THROW(emplace_back(2));
- BOOST_CHECK_NO_THROW(emplace_back(3));
- BOOST_CHECK_NO_THROW(emplace_back(4));
- BOOST_CHECK_NO_THROW(pop_back());
- BOOST_CHECK_EQUAL(size_, 3);
- BOOST_CHECK_EQUAL(capacity_, 4);
-
- BOOST_CHECK_NO_THROW(emplace(begin(), 5));
- BOOST_CHECK_EQUAL(size_, 4);
- BOOST_CHECK_EQUAL(capacity_, 4);
- {
- std::array expected1 {5, 1, 2, 3};
- BOOST_CHECK_EQUAL_COLLECTIONS(begin(), end(), expected1.begin(), expected1.end());
- }
-
- {
- std::array expected1 {2, 3};
- BOOST_CHECK_EQUAL_COLLECTIONS(begin() + 2, end(), expected1.begin(), expected1.end());
- }
- BOOST_CHECK_NO_THROW(insert(begin() + 2, 6));
- BOOST_CHECK_EQUAL(size_, 5);
- BOOST_CHECK_EQUAL(capacity_, 8);
- {
- std::array expected1 {5, 1, 6, 2, 3};
- BOOST_CHECK_EQUAL_COLLECTIONS(begin(), end(), expected1.begin(), expected1.end());
- }
- erase(begin() + 1);
- BOOST_CHECK_EQUAL(size_, 4);
- BOOST_CHECK_EQUAL(capacity_, 8);
- {
- std::array expected1 {5, 6, 2, 3};
- BOOST_CHECK_EQUAL_COLLECTIONS(begin(), end(), expected1.begin(), expected1.end());
- }
- erase(begin() + 1, end() - 1);
- BOOST_CHECK_EQUAL(size_, 2);
- BOOST_CHECK_EQUAL(capacity_, 8);
- {
- std::array expected1 {5, 3};
- BOOST_CHECK_EQUAL_COLLECTIONS(begin(), end(), expected1.begin(), expected1.end());
- }
-}
-
-BOOST_AUTO_TEST_CASE(StlCompatilibty)
-{
- BOOST_CHECK_NO_THROW(resize(10));
- BOOST_CHECK_NO_THROW(std::generate(begin(), end(), [value = 0]() mutable {
- return value++;
- }));
- BOOST_CHECK_NO_THROW(std::sort(rbegin(), rend()));
- {
- std::array expected1 {9, 8, 7, 6, 5, 4, 3, 2, 1, 0};
- BOOST_CHECK_EQUAL_COLLECTIONS(begin(), end(), expected1.begin(), expected1.end());
- }
- const auto newend = std::remove_if(begin(), end(), [](const auto & value) {
- return value % 2 == 0;
- });
- {
- std::array expected1 {9, 7, 5, 3, 1};
- BOOST_CHECK_EQUAL_COLLECTIONS(begin(), newend, expected1.begin(), expected1.end());
- }
-}
-
-BOOST_AUTO_TEST_CASE(IterCompare)
-{
- BOOST_CHECK_EQUAL(begin(), end());
- BOOST_CHECK_EQUAL(rbegin(), rend());
- emplace_back();
- BOOST_CHECK_LT(begin(), end());
- BOOST_CHECK_LT(rbegin(), rend());
- BOOST_CHECK_LT(cbegin(), cend());
- BOOST_CHECK_LT(crbegin(), crend());
-}
-
-BOOST_AUTO_TEST_SUITE_END();
-
-BOOST_AUTO_TEST_CASE(CreateCopySource, *boost::unit_test::timeout(1))
-{
- const std::vector src {4, 6, 2, 4, 6, 0};
- glContainer dst {src};
- static_assert(std::is_same_v<decltype(src)::value_type, decltype(dst)::value_type>);
- dst.unmap();
- BOOST_CHECK_EQUAL_COLLECTIONS(src.begin(), src.end(), dst.begin(), dst.end());
-}
-
-namespace {
- struct C {
- int x;
- float y;
- };
-
- static_assert(std::is_trivially_destructible_v<C>);
-
- struct CC {
- CC() = default;
-
- CC(int intValue, float floatValue) noexcept : x {intValue}, y {floatValue} { }
-
- ~CC()
- {
- ++x;
- }
-
- DEFAULT_MOVE_COPY(CC);
-
- int x;
- float y;
- };
-
- static_assert(!std::is_trivially_destructible_v<CC>);
-}
-
-BOOST_FIXTURE_TEST_SUITE(c, glContainer<C>)
-
-BOOST_AUTO_TEST_CASE(Basic)
-{
- BOOST_CHECK_NO_THROW(emplace_back(1, 2.F));
- BOOST_CHECK_EQUAL(1, begin()->x);
- BOOST_CHECK_EQUAL(2.F, begin()->y);
- BOOST_CHECK_NO_THROW(begin()->x = 3);
- BOOST_CHECK_EQUAL(3, begin()->x);
-
- BOOST_CHECK_NO_THROW(push_back(C {4, 5.F}));
- BOOST_CHECK_EQUAL(3, begin()->x);
- BOOST_CHECK_EQUAL(2.F, begin()->y);
- BOOST_CHECK_EQUAL(4, rbegin()->x);
- BOOST_CHECK_EQUAL(5.F, rbegin()->y);
-}
-
-BOOST_AUTO_TEST_SUITE_END();
-
-BOOST_FIXTURE_TEST_SUITE(cc, glContainer<CC>)
-
-BOOST_AUTO_TEST_CASE(Basic)
-{
- BOOST_CHECK_NO_THROW(emplace_back(1, 2.F));
- BOOST_CHECK_EQUAL(1, begin()->x);
- BOOST_CHECK_EQUAL(2.F, begin()->y);
- BOOST_CHECK_NO_THROW(begin()->x = 3);
- BOOST_CHECK_EQUAL(3, begin()->x);
-
- BOOST_CHECK_NO_THROW(push_back(CC {4, 5.F}));
- BOOST_CHECK_EQUAL(3, begin()->x);
- BOOST_CHECK_EQUAL(2.F, begin()->y);
- BOOST_CHECK_EQUAL(4, rbegin()->x);
- BOOST_CHECK_EQUAL(5.F, rbegin()->y);
- BOOST_CHECK_NO_THROW(pop_back());
- BOOST_CHECK_EQUAL(size(), 1);
- BOOST_CHECK_EQUAL(capacity(), 2);
- BOOST_CHECK_NO_THROW(resize(3));
- BOOST_CHECK_EQUAL(size(), 3);
- BOOST_CHECK_EQUAL(capacity(), 3);
- BOOST_CHECK_NO_THROW(resize(1));
- BOOST_CHECK_EQUAL(size(), 1);
- BOOST_CHECK_EQUAL(capacity(), 1);
-}
-
-BOOST_AUTO_TEST_CASE(InsertRemoveTest)
-{
- BOOST_CHECK_NO_THROW(emplace_back(1, 2.F));
- BOOST_CHECK_NO_THROW(emplace_back(3, 4.F));
- BOOST_CHECK_NO_THROW(emplace(begin(), 5, 6.F));
- BOOST_CHECK_NO_THROW(emplace(begin() + 1, 7, 8.F));
- BOOST_CHECK_NO_THROW(emplace(begin() + 2, 9, 10.F));
- BOOST_CHECK_EQUAL(capacity(), 8);
- BOOST_CHECK_EQUAL(size(), 5);
- BOOST_CHECK_NO_THROW(shrink_to_fit());
- BOOST_CHECK_EQUAL(capacity(), 5);
- BOOST_CHECK_EQUAL(size(), 5);
-}
-
-BOOST_AUTO_TEST_SUITE_END();
diff --git a/test/test-instancing.cpp b/test/test-instancing.cpp
index 4748f93..399a84c 100644
--- a/test/test-instancing.cpp
+++ b/test/test-instancing.cpp
@@ -77,19 +77,6 @@ BOOST_AUTO_TEST_CASE(AcquireReleaseMove)
BOOST_CHECK(reverseIndex.empty());
}
-BOOST_AUTO_TEST_CASE(AutoMapUnmap)
-{
- {
- auto proxy = acquire();
- BOOST_CHECK(data_);
- std::ignore = bufferName();
- BOOST_CHECK(data_);
- BOOST_CHECK_EQUAL(1, size());
- BOOST_CHECK(!data_);
- }
- BOOST_CHECK_EQUAL(0, size());
-}
-
BOOST_AUTO_TEST_CASE(Initialize)
{
auto proxy = acquire(5);
@@ -246,7 +233,7 @@ BOOST_AUTO_TEST_CASE(PartitionBy, *boost::unit_test::timeout(1))
};
auto matchedEnd = partition(pred);
// The underlying data is partitioned...
- BOOST_REQUIRE(std::is_partitioned(mkcspan().cbegin(), mkcspan().cend(), pred));
+ BOOST_REQUIRE(std::is_partitioned(cbegin(), cend(), pred));
// The external view of the data is unchanged...
BOOST_CHECK_EQUAL_COLLECTIONS(values.cbegin(), values.cend(), instances.cbegin(), instances.cend());
// The partition point is right...
@@ -281,7 +268,7 @@ BOOST_AUTO_TEST_CASE(PartitionBy2, *boost::unit_test::timeout(1))
auto matchedBoundaries = partition(pred3, pred5);
// As PartitionBy... primary partition is normal layout
// The underlying data is partitioned...
- BOOST_REQUIRE(std::is_partitioned(mkcspan().cbegin(), mkcspan().cend(), pred3));
+ BOOST_REQUIRE(std::is_partitioned(cbegin(), cend(), pred3));
// The external view of the data is unchanged...
BOOST_CHECK_EQUAL_COLLECTIONS(values.cbegin(), values.cend(), instances.cbegin(), instances.cend());
// The partition point is right...
@@ -291,19 +278,17 @@ BOOST_AUTO_TEST_CASE(PartitionBy2, *boost::unit_test::timeout(1))
// Secondary partition lives contiguous in the middle somewhere, with two falsy blocks at each end
const auto p2bndry = matchedBoundaries.second;
- BOOST_TEST_CONTEXT(mkcspan()) {
+ BOOST_TEST_CONTEXT(std::span(cbegin(), cend())) {
BOOST_TEST_CONTEXT(matchedBoundaries.first) {
- BOOST_CHECK(std::all_of(
- mkcspan().cbegin(), mkcspan().cbegin() + static_cast<int>(matchedBoundaries.first), pred3));
- BOOST_CHECK(std::none_of(
- mkcspan().cbegin() + static_cast<int>(matchedBoundaries.first), mkcspan().cend(), pred3));
+ BOOST_CHECK(std::all_of(cbegin(), cbegin() + static_cast<int>(matchedBoundaries.first), pred3));
+ BOOST_CHECK(std::none_of(cbegin() + static_cast<int>(matchedBoundaries.first), cend(), pred3));
}
BOOST_TEST_CONTEXT(p2bndry) {
- BOOST_CHECK(std::all_of(mkcspan().cbegin() + static_cast<int>(p2bndry.first),
- mkcspan().begin() + static_cast<int>(p2bndry.second), pred5));
- BOOST_CHECK(std::none_of(mkcspan().cbegin(), mkcspan().cbegin() + static_cast<int>(p2bndry.first), pred5));
- BOOST_CHECK(std::none_of(mkcspan().cbegin() + static_cast<int>(p2bndry.second), mkcspan().cend(), pred5));
+ BOOST_CHECK(std::all_of(
+ cbegin() + static_cast<int>(p2bndry.first), cbegin() + static_cast<int>(p2bndry.second), pred5));
+ BOOST_CHECK(std::none_of(cbegin(), cbegin() + static_cast<int>(p2bndry.first), pred5));
+ BOOST_CHECK(std::none_of(cbegin() + static_cast<int>(p2bndry.second), cend(), pred5));
}
}