diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-13 15:09:38 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-13 15:09:38 +0000 |
commit | 3529eba77e2e5af672369e73d73c1084616c10e9 (patch) | |
tree | eda097c081a6c15945f5a681afbc39bba1f33741 /test | |
parent | Use std::span for iterator/data pointer in glContainer (diff) | |
download | ilt-3529eba77e2e5af672369e73d73c1084616c10e9.tar.bz2 ilt-3529eba77e2e5af672369e73d73c1084616c10e9.tar.xz ilt-3529eba77e2e5af672369e73d73c1084616c10e9.zip |
Add glContainer::at override to update a single item
Diffstat (limited to 'test')
-rw-r--r-- | test/test-glContainer.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/test-glContainer.cpp b/test/test-glContainer.cpp index 9d4f198..0597470 100644 --- a/test/test-glContainer.cpp +++ b/test/test-glContainer.cpp @@ -204,6 +204,29 @@ BOOST_AUTO_TEST_CASE(random_access) BOOST_CHECK_EQUAL(1, *i); } +BOOST_AUTO_TEST_CASE(random_write) +{ + BOOST_CHECK_NO_THROW(resize(3)); + BOOST_CHECK_EQUAL(size(), 3); + BOOST_CHECK_NO_THROW(unmap()); + BOOST_REQUIRE(!data_.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_.data()); + { + std::array expected1 {10, 20, 30}; + BOOST_CHECK_EQUAL_COLLECTIONS(begin(), end(), expected1.begin(), expected1.end()); + } + BOOST_CHECK(data_.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(insert_remove_test) { BOOST_CHECK_NO_THROW(emplace_back(1)); |