summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test-glContainer.cpp23
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));