OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "courgette/memory_allocator.h" | 5 #include "courgette/memory_allocator.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 |
7 #include <algorithm> | 9 #include <algorithm> |
8 | 10 |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
11 | 13 |
12 TEST(MemoryAllocatorTest, NoThrowBuffer) { | 14 TEST(MemoryAllocatorTest, NoThrowBuffer) { |
13 const size_t size_list[] = {0U, 1U, 2U, 11U, 15U, 16U}; | 15 const size_t size_list[] = {0U, 1U, 2U, 11U, 15U, 16U}; |
14 | 16 |
15 // Repeat test for different sizes. | 17 // Repeat test for different sizes. |
16 for (size_t idx = 0; idx < arraysize(size_list); ++idx) { | 18 for (size_t idx = 0; idx < arraysize(size_list); ++idx) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 EXPECT_EQ(buf1[i], buf2[i]); | 70 EXPECT_EQ(buf1[i], buf2[i]); |
69 for (size_t i = new_size; i < size; ++i) | 71 for (size_t i = new_size; i < size; ++i) |
70 EXPECT_EQ(kNewValue, buf2[i]); | 72 EXPECT_EQ(kNewValue, buf2[i]); |
71 | 73 |
72 // Test clear(). | 74 // Test clear(). |
73 buf2.clear(); | 75 buf2.clear(); |
74 EXPECT_EQ(0U, buf2.size()); | 76 EXPECT_EQ(0U, buf2.size()); |
75 EXPECT_TRUE(buf2.empty()); | 77 EXPECT_TRUE(buf2.empty()); |
76 } | 78 } |
77 } | 79 } |
OLD | NEW |