1 // Copyright 2021 The PDFium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "core/fxcrt/scoped_set_insertion.h" 6 7 #include "testing/gmock/include/gmock/gmock.h" 8 #include "testing/gtest/include/gtest/gtest.h" 9 TEST(fxcrt,ScopedSetInsertion)10TEST(fxcrt, ScopedSetInsertion) { 11 std::set<int> container; 12 { 13 ScopedSetInsertion<int> insertion(&container, 5); 14 EXPECT_THAT(container, testing::UnorderedElementsAreArray({5})); 15 16 { 17 ScopedSetInsertion<int> insertion2(&container, 6); 18 EXPECT_THAT(container, testing::UnorderedElementsAreArray({5, 6})); 19 } 20 21 EXPECT_THAT(container, testing::UnorderedElementsAreArray({5})); 22 } 23 EXPECT_TRUE(container.empty()); 24 } 25