summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-01-13 14:35:39 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-01-13 14:35:39 +0000
commitda6b8b00f742249138077ce9bcd92d8fd4f48ef8 (patch)
tree300776f2632b6a8e0b1eb94fc6852b478e2f6141 /test
parentDefault destructor for trivial types of glContainer (diff)
downloadilt-da6b8b00f742249138077ce9bcd92d8fd4f48ef8.tar.bz2
ilt-da6b8b00f742249138077ce9bcd92d8fd4f48ef8.tar.xz
ilt-da6b8b00f742249138077ce9bcd92d8fd4f48ef8.zip
Use std::span for iterator/data pointer in glContainer
Diffstat (limited to 'test')
-rw-r--r--test/Jamfile.jam2
-rw-r--r--test/test-glContainer.cpp27
-rw-r--r--test/test-instancing.cpp6
3 files changed, 20 insertions, 15 deletions
diff --git a/test/Jamfile.jam b/test/Jamfile.jam
index 4086e0c..c109051 100644
--- a/test/Jamfile.jam
+++ b/test/Jamfile.jam
@@ -58,7 +58,7 @@ run perf-assetFactory.cpp : -- : test-assetFactory : <library>benchmark <library
run perf-geoData.cpp : : : <library>test <library>benchmark ;
run perf-persistence.cpp : -- : test-persistence : <library>benchmark <library>test ;
run test-worker.cpp ;
-run test-instancing.cpp : : : <library>test ;
+run test-instancing.cpp : -- : test-glContainer : <library>test ;
run test-glContainer.cpp : : : <library>test ;
run test-pack.cpp : : : <library>test ;
compile test-static-enumDetails.cpp ;
diff --git a/test/test-glContainer.cpp b/test/test-glContainer.cpp
index cd57a6b..9d4f198 100644
--- a/test/test-glContainer.cpp
+++ b/test/test-glContainer.cpp
@@ -8,10 +8,13 @@
#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>::reserve_iterator);
-BOOST_TEST_DONT_PRINT_LOG_VALUE(glContainer<int>::const_reserve_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(ApplicationBase);
BOOST_GLOBAL_FIXTURE(TestMainWindow);
@@ -20,14 +23,14 @@ BOOST_FIXTURE_TEST_SUITE(i, glContainer<int>)
BOOST_AUTO_TEST_CASE(createDestroy, *boost::unit_test::timeout(1))
{
- BOOST_CHECK(!data_);
+ BOOST_CHECK(!data_.data());
BOOST_CHECK_NO_THROW(map());
- BOOST_REQUIRE(!data_);
+ BOOST_REQUIRE(!data_.data());
BOOST_CHECK_NO_THROW(emplace_back(0));
BOOST_CHECK_NO_THROW(map());
- BOOST_REQUIRE(data_);
+ BOOST_REQUIRE(data_.data());
BOOST_CHECK_NO_THROW(unmap());
- BOOST_CHECK(!data_);
+ BOOST_CHECK(!data_.data());
}
BOOST_AUTO_TEST_CASE(push_back_test, *boost::unit_test::timeout(1))
@@ -38,10 +41,12 @@ BOOST_AUTO_TEST_CASE(push_back_test, *boost::unit_test::timeout(1))
BOOST_CHECK_NO_THROW(push_back(2));
BOOST_CHECK_NO_THROW(push_back(3));
BOOST_CHECK_NO_THROW(push_back(4));
- BOOST_CHECK_EQUAL(capacity_, 4);
- BOOST_CHECK_EQUAL(size_, 4);
+ BOOST_CHECK_NO_THROW(push_back(5));
+ BOOST_CHECK_EQUAL(capacity_, 8);
+ BOOST_CHECK_EQUAL(size_, 5);
+ BOOST_CHECK_EQUAL(data_.size(), 5);
{
- std::array expected1 {1, 2, 3, 4};
+ 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());
}
@@ -161,7 +166,7 @@ BOOST_AUTO_TEST_CASE(getters)
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_EQUAL(data_.data(), data());
BOOST_CHECK_THROW(std::ignore = at(2), std::out_of_range);
const auto & constCont {*this};
@@ -178,7 +183,7 @@ BOOST_AUTO_TEST_CASE(getters)
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_EQUAL(data_.data(), constCont.data());
BOOST_CHECK_THROW(std::ignore = constCont.at(2), std::out_of_range);
}
diff --git a/test/test-instancing.cpp b/test/test-instancing.cpp
index c1860a4..98133f3 100644
--- a/test/test-instancing.cpp
+++ b/test/test-instancing.cpp
@@ -56,11 +56,11 @@ BOOST_AUTO_TEST_CASE(autoMapUnmap)
{
{
auto proxy = acquire();
- BOOST_CHECK(data_);
+ BOOST_CHECK(data_.data());
std::ignore = bufferName();
- BOOST_CHECK(data_);
+ BOOST_CHECK(data_.data());
BOOST_CHECK_EQUAL(1, size());
- BOOST_CHECK(!data_);
+ BOOST_CHECK(!data_.data());
}
BOOST_CHECK_EQUAL(0, size());
}