| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "net/quic/congestion_control/quic_max_sized_map.h" | 6 #include "net/quic/congestion_control/quic_max_sized_map.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 namespace net { | 9 namespace net { |
| 10 namespace test { | 10 namespace test { |
| 11 | 11 |
| 12 class QuicMaxSizedMapTest : public ::testing::Test { | 12 class QuicMaxSizedMapTest : public ::testing::Test {}; |
| 13 }; | |
| 14 | 13 |
| 15 TEST_F(QuicMaxSizedMapTest, Basic) { | 14 TEST_F(QuicMaxSizedMapTest, Basic) { |
| 16 QuicMaxSizedMap<int, int> test_map(100); | 15 QuicMaxSizedMap<int, int> test_map(100); |
| 17 EXPECT_EQ(100u, test_map.MaxSize()); | 16 EXPECT_EQ(100u, test_map.MaxSize()); |
| 18 EXPECT_EQ(0u, test_map.Size()); | 17 EXPECT_EQ(0u, test_map.Size()); |
| 19 test_map.Insert(1, 2); | 18 test_map.Insert(1, 2); |
| 20 test_map.Insert(1, 3); | 19 test_map.Insert(1, 3); |
| 21 EXPECT_EQ(100u, test_map.MaxSize()); | 20 EXPECT_EQ(100u, test_map.MaxSize()); |
| 22 EXPECT_EQ(2u, test_map.Size()); | 21 EXPECT_EQ(2u, test_map.Size()); |
| 23 test_map.RemoveAll(); | 22 test_map.RemoveAll(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 QuicMaxSizedMap<int, int>::ConstIterator it = test_map.Begin(); | 56 QuicMaxSizedMap<int, int>::ConstIterator it = test_map.Begin(); |
| 58 for (int i = 0; i < 10; ++i, ++it) { | 57 for (int i = 0; i < 10; ++i, ++it) { |
| 59 EXPECT_TRUE(it != test_map.End()); | 58 EXPECT_TRUE(it != test_map.End()); |
| 60 EXPECT_EQ(i, it->first); | 59 EXPECT_EQ(i, it->first); |
| 61 EXPECT_EQ(i, it->second); | 60 EXPECT_EQ(i, it->second); |
| 62 } | 61 } |
| 63 } | 62 } |
| 64 | 63 |
| 65 } // namespace test | 64 } // namespace test |
| 66 } // namespace net | 65 } // namespace net |
| OLD | NEW |