diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-05-01 16:08:25 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-05-01 16:08:25 +0100 |
commit | d23fbdbe85404da8f8e0f3697852e83cc2192c38 (patch) | |
tree | 7ce39ccadf7568bb349c9af515c42c147fa99bb4 /test | |
parent | Extend glContainer with most of the interface expected of an STL container (diff) | |
download | ilt-d23fbdbe85404da8f8e0f3697852e83cc2192c38.tar.bz2 ilt-d23fbdbe85404da8f8e0f3697852e83cc2192c38.tar.xz ilt-d23fbdbe85404da8f8e0f3697852e83cc2192c38.zip |
glContainer should at least double in capacity as required
Diffstat (limited to 'test')
-rw-r--r-- | test/test-glContainer.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/test/test-glContainer.cpp b/test/test-glContainer.cpp index 5df56d4..09d21d1 100644 --- a/test/test-glContainer.cpp +++ b/test/test-glContainer.cpp @@ -77,7 +77,7 @@ BOOST_AUTO_TEST_CASE(emplace_back_test, *boost::unit_test::timeout(1)) BOOST_CHECK_EQUAL(size_, 5); BOOST_CHECK_NO_THROW(emplace_back(6)); BOOST_CHECK_NO_THROW(emplace_back(7)); - BOOST_CHECK_EQUAL(capacity_, 7); + BOOST_CHECK_EQUAL(capacity_, 10); BOOST_CHECK_EQUAL(size_, 7); { @@ -223,21 +223,21 @@ BOOST_AUTO_TEST_CASE(insert_remove_test) } BOOST_CHECK_NO_THROW(insert(begin() + 2, 6)); BOOST_CHECK_EQUAL(size_, 5); - BOOST_CHECK_EQUAL(capacity_, 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_, 5); + 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_, 5); + BOOST_CHECK_EQUAL(capacity_, 8); { std::array expected1 {5, 3}; BOOST_CHECK_EQUAL_COLLECTIONS(begin(), end(), expected1.begin(), expected1.end()); @@ -333,6 +333,9 @@ BOOST_AUTO_TEST_CASE(insert_remove_test) 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); } |