| OLD | NEW |
| 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file |
| 2 // for details. all rights reserved. use of this source code is governed by a | 2 // for details. all rights reserved. use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 #include "src/shared/assert.h" | 5 #include "src/shared/assert.h" |
| 6 #include "src/shared/flags.h" | 6 #include "src/shared/flags.h" |
| 7 #include "src/shared/test_case.h" | 7 #include "src/shared/test_case.h" |
| 8 | 8 |
| 9 #include "src/vm/priority_heap.h" | 9 #include "src/vm/priority_heap.h" |
| 10 | 10 |
| 11 namespace fletch { | 11 namespace dartino { |
| 12 | 12 |
| 13 TEST_CASE(PRIORITY_HEAP_WITH_INDEX__INCREASING) { | 13 TEST_CASE(PRIORITY_HEAP_WITH_INDEX__INCREASING) { |
| 14 const word kSize = PriorityHeapWithValueIndex<word, word>::kMinimumSize; | 14 const word kSize = PriorityHeapWithValueIndex<word, word>::kMinimumSize; |
| 15 | 15 |
| 16 PriorityHeapWithValueIndex<word, word> heap; | 16 PriorityHeapWithValueIndex<word, word> heap; |
| 17 for (word i = 0; i < kSize; i++) { | 17 for (word i = 0; i < kSize; i++) { |
| 18 heap.Insert(i, 10 + i); | 18 heap.Insert(i, 10 + i); |
| 19 } | 19 } |
| 20 ASSERT(heap.backing_size() == kSize); | 20 ASSERT(heap.backing_size() == kSize); |
| 21 for (word i = 0; i < kSize; i++) { | 21 for (word i = 0; i < kSize; i++) { |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 EXPECT_EQ(expected_priority, heap.Minimum().priority); | 160 EXPECT_EQ(expected_priority, heap.Minimum().priority); |
| 161 EXPECT_EQ(10 + i, heap.Minimum().value); | 161 EXPECT_EQ(10 + i, heap.Minimum().value); |
| 162 EXPECT(heap.ContainsValue(10 + i)); | 162 EXPECT(heap.ContainsValue(10 + i)); |
| 163 heap.RemoveMinimum(); | 163 heap.RemoveMinimum(); |
| 164 EXPECT(!heap.ContainsValue(10 + i)); | 164 EXPECT(!heap.ContainsValue(10 + i)); |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 EXPECT(heap.IsEmpty()); | 167 EXPECT(heap.IsEmpty()); |
| 168 } | 168 } |
| 169 | 169 |
| 170 } // namespace fletch. | 170 } // namespace dartino. |
| OLD | NEW |