Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c809b00 authored by John Reck's avatar John Reck Committed by android-build-merger
Browse files

Merge "Add basic LsaVector tests" into nyc-dev

am: 99f12156

* commit '99f12156':
  Add basic LsaVector tests
parents 07c1617b 99f12156
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -113,3 +113,21 @@ TEST(LinearStdAllocator, simpleAllocate) {
    EXPECT_GT(lastLocation + 20, &v[0]);

}

TEST(LsaVector, dtorCheck) {
    LinearAllocator allocator;
    LinearStdAllocator<void*> stdAllocator(allocator);

    for (int size : {1, 2, 3, 500}) {
        int destroyed = 0;
        {
            LsaVector<std::unique_ptr<TestUtils::SignalingDtor> > 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);
    }
}