From 308dba5d92cf7448e4025bb98e30601f69df52c1 Mon Sep 17 00:00:00 2001 From: John Reck Date: Tue, 8 Mar 2016 13:20:06 -0800 Subject: [PATCH] Add basic LsaVector tests Change-Id: I57600271a4efcb63b1c24b582ead48d51f002c2e --- libs/hwui/tests/unit/LinearAllocatorTests.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/libs/hwui/tests/unit/LinearAllocatorTests.cpp b/libs/hwui/tests/unit/LinearAllocatorTests.cpp index 402a09c55e8f4..ffcbf128fc3a5 100644 --- a/libs/hwui/tests/unit/LinearAllocatorTests.cpp +++ b/libs/hwui/tests/unit/LinearAllocatorTests.cpp @@ -113,3 +113,21 @@ TEST(LinearStdAllocator, simpleAllocate) { EXPECT_GT(lastLocation + 20, &v[0]); } + +TEST(LsaVector, dtorCheck) { + LinearAllocator allocator; + LinearStdAllocator stdAllocator(allocator); + + for (int size : {1, 2, 3, 500}) { + int destroyed = 0; + { + LsaVector > vector(stdAllocator); + for (int i = 0; i < size; i++) { + vector.emplace_back(new TestUtils::SignalingDtor(&destroyed)); + } + EXPECT_EQ(0, destroyed); + EXPECT_EQ(size, (int) vector.size()); + } + EXPECT_EQ(size, destroyed); + } +}