summaryrefslogtreecommitdiff
path: root/asl/containers/chunked_buffer_tests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'asl/containers/chunked_buffer_tests.cpp')
-rw-r--r--asl/containers/chunked_buffer_tests.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/asl/containers/chunked_buffer_tests.cpp b/asl/containers/chunked_buffer_tests.cpp
index 797f7f1..ba29bfb 100644
--- a/asl/containers/chunked_buffer_tests.cpp
+++ b/asl/containers/chunked_buffer_tests.cpp
@@ -135,6 +135,48 @@ ASL_TEST(push)
}
}
+ASL_TEST(pop)
+{
+ asl::chunked_buffer<int, 2> b;
+
+ for (int i = 0; i < 8; ++i)
+ {
+ b.push(i);
+ }
+ ASL_TEST_EXPECT(b.size() == 8);
+
+ b.pop();
+ ASL_TEST_EXPECT(b.size() == 7);
+ for (int i = 0; i < 7; ++i)
+ {
+ ASL_TEST_EXPECT(b[i] == i);
+ }
+}
+
+ASL_TEST(pop_destruct)
+{
+ asl::chunked_buffer<DestructorObserver, 16> b;
+ bool d[3];
+
+ b.push(&d[0]);
+ b.push(&d[1]);
+ b.push(&d[2]);
+
+ ASL_TEST_EXPECT(!d[0]);
+ ASL_TEST_EXPECT(!d[1]);
+ ASL_TEST_EXPECT(!d[2]);
+
+ b.pop();
+ ASL_TEST_EXPECT(!d[0]);
+ ASL_TEST_EXPECT(!d[1]);
+ ASL_TEST_EXPECT(d[2]);
+
+ b.pop();
+ ASL_TEST_EXPECT(!d[0]);
+ ASL_TEST_EXPECT(d[1]);
+ ASL_TEST_EXPECT(d[2]);
+}
+
ASL_TEST(clear_destroy)
{
bool destroyed[5]{};