// // Copyright 2018 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // // ResourceMap_unittest: // Unit tests for the ResourceMap template class. // #include <gtest/gtest.h> #include <map> #include "libANGLE/ResourceMap.h" usingnamespacegl; namespace gl { template <> inline GLuint GetIDValue(int id) { … } template <> inline GLuint GetIDValue(unsigned int id) { … } } // namespace gl namespace { // The resourceMap class uses a lock for "unsigned int" types to support this unit test. LocklessType; LockedType; template <typename T> void AssignAndErase() { … } // Tests assigning slots in the map and then deleting elements. TEST(ResourceMapTest, AssignAndEraseLockless) { … } // Tests assigning slots in the map and then deleting elements. TEST(ResourceMapTest, AssignAndEraseLocked) { … } template <typename T> void AssignAndClear() { … } // Tests assigning slots in the map and then using clear() to free it. TEST(ResourceMapTest, AssignAndClearLockless) { … } // Tests assigning slots in the map and then using clear() to free it. TEST(ResourceMapTest, AssignAndClearLocked) { … } template <typename T> void BigGrowth() { … } // Tests growing a map more than double the size. TEST(ResourceMapTest, BigGrowthLockless) { … } // Tests growing a map more than double the size. TEST(ResourceMapTest, BigGrowthLocked) { … } template <typename T> void QueryUnassigned() { … } // Tests querying unassigned or erased values. TEST(ResourceMapTest, QueryUnassignedLockless) { … } // Tests querying unassigned or erased values. TEST(ResourceMapTest, QueryUnassignedLocked) { … } void ConcurrentAccess(size_t iterations, size_t idCycleSize) { … } // Tests that concurrent access to thread-safe resource maps works for small ids that are mostly in // the flat map range. TEST(ResourceMapTest, ConcurrentAccessSmallIds) { … } // Tests that concurrent access to thread-safe resource maps works for a wider range of ids. TEST(ResourceMapTest, ConcurrentAccessLargeIds) { … } } // anonymous namespace