TEST(VectorMapTest, InsertTest) { Vec v; ASSERT_TRUE(v.empty()); ASSERT_EQ(0, v.size()); v.insert(10, 1); ASSERT_TRUE(v.end() != v.find(10)); Pair const& p = *(v.find(10)); ASSERT_EQ(1, p.second); }
TEST(VectorMapTest, EraseTest) { Vec v; ASSERT_TRUE(v.empty()); ASSERT_EQ(0, v.size()); ASSERT_FALSE(v.remove(10)); v.insert(10, 1); v.insert(11, 2); ASSERT_TRUE(v.end() != v.find(10)); { Pair const& p = *(v.find(10)); ASSERT_EQ(1, p.second); } { Pair const& p = *(v.erase( v.find(10) )); ASSERT_EQ(2, p.second); } }
inline void insert_flattened(const T* first, const T* last, Vec& vec) { vec.insert(vec.end(), first, last); }