| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart 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 file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/assert.h" | 5 #include "platform/assert.h" |
| 6 #include "vm/growable_array.h" | 6 #include "vm/growable_array.h" |
| 7 #include "vm/unit_test.h" | 7 #include "vm/unit_test.h" |
| 8 | 8 |
| 9 namespace dart { | 9 namespace dart { |
| 10 | 10 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 GrowableArray<int> g; | 89 GrowableArray<int> g; |
| 90 g.Add(12); | 90 g.Add(12); |
| 91 g.Add(4); | 91 g.Add(4); |
| 92 g.Add(64); | 92 g.Add(64); |
| 93 g.Add(8); | 93 g.Add(8); |
| 94 g.Sort(greatestFirst); | 94 g.Sort(greatestFirst); |
| 95 EXPECT_EQ(64, g[0]); | 95 EXPECT_EQ(64, g[0]); |
| 96 EXPECT_EQ(4, g.Last()); | 96 EXPECT_EQ(4, g.Last()); |
| 97 } | 97 } |
| 98 | 98 |
| 99 |
| 100 TEST_CASE(GrowableHandlePtr) { |
| 101 Zone* zone = Thread::Current()->zone(); |
| 102 GrowableHandlePtrArray<const String> test1(zone, 1); |
| 103 EXPECT_EQ(0, test1.length()); |
| 104 test1.Add(Symbols::Int()); |
| 105 EXPECT(test1[0].raw() == Symbols::Int().raw()); |
| 106 EXPECT_EQ(1, test1.length()); |
| 107 |
| 108 ZoneGrowableHandlePtrArray<const String>* test2 = |
| 109 new ZoneGrowableHandlePtrArray<const String>(zone, 1); |
| 110 test2->Add(Symbols::GetterPrefix()); |
| 111 EXPECT((*test2)[0].raw() == Symbols::GetterPrefix().raw()); |
| 112 EXPECT_EQ(1, test2->length()); |
| 113 } |
| 114 |
| 99 } // namespace dart | 115 } // namespace dart |
| OLD | NEW |