summaryrefslogtreecommitdiff
path: root/test/test-glContainer.cpp
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/test-glContainer.cpp
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/test-glContainer.cpp')
-rw-r--r--test/test-glContainer.cpp27
1 files changed, 16 insertions, 11 deletions
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);
}