Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: runtime/vm/growable_array_test.cc

Issue 2481873005: clang-format runtime/vm (Closed)
Patch Set: Merge Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/growable_array.h ('k') | runtime/vm/guard_field_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 template<class GrowableArrayInt, class GrowableArrayInt64> 11 template <class GrowableArrayInt, class GrowableArrayInt64>
12 void TestGrowableArray() { 12 void TestGrowableArray() {
13 GrowableArrayInt g; 13 GrowableArrayInt g;
14 EXPECT_EQ(0, g.length()); 14 EXPECT_EQ(0, g.length());
15 EXPECT(g.is_empty()); 15 EXPECT(g.is_empty());
16 g.Add(5); 16 g.Add(5);
17 EXPECT_EQ(5, g[0]); 17 EXPECT_EQ(5, g[0]);
18 EXPECT_EQ(1, g.length()); 18 EXPECT_EQ(1, g.length());
19 EXPECT(!g.is_empty()); 19 EXPECT(!g.is_empty());
20 g.Add(3); 20 g.Add(3);
21 const GrowableArrayInt& temp = g; 21 const GrowableArrayInt& temp = g;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 EXPECT(h.is_empty()); 57 EXPECT(h.is_empty());
58 h.Add(-8899); 58 h.Add(-8899);
59 h.Add(7908); 59 h.Add(7908);
60 EXPECT(!h.is_empty()); 60 EXPECT(!h.is_empty());
61 h.Clear(); 61 h.Clear();
62 EXPECT(h.is_empty()); 62 EXPECT(h.is_empty());
63 } 63 }
64 64
65 65
66 TEST_CASE(GrowableArray) { 66 TEST_CASE(GrowableArray) {
67 TestGrowableArray<GrowableArray<int>, 67 TestGrowableArray<GrowableArray<int>, GrowableArray<int64_t> >();
68 GrowableArray<int64_t> >();
69 } 68 }
70 69
71 70
72 TEST_CASE(MallocGrowableArray) { 71 TEST_CASE(MallocGrowableArray) {
73 TestGrowableArray<MallocGrowableArray<int>, 72 TestGrowableArray<MallocGrowableArray<int>, MallocGrowableArray<int64_t> >();
74 MallocGrowableArray<int64_t> >();
75 } 73 }
76 74
77 75
78 static int greatestFirst(const int* a, const int* b) { 76 static int greatestFirst(const int* a, const int* b) {
79 if (*a > *b) { 77 if (*a > *b) {
80 return -1; 78 return -1;
81 } else if (*a < *b) { 79 } else if (*a < *b) {
82 return 1; 80 return 1;
83 } else { 81 } else {
84 return 0; 82 return 0;
(...skipping 21 matching lines...) Expand all
106 EXPECT_EQ(1, test1.length()); 104 EXPECT_EQ(1, test1.length());
107 105
108 ZoneGrowableHandlePtrArray<const String>* test2 = 106 ZoneGrowableHandlePtrArray<const String>* test2 =
109 new ZoneGrowableHandlePtrArray<const String>(zone, 1); 107 new ZoneGrowableHandlePtrArray<const String>(zone, 1);
110 test2->Add(Symbols::GetterPrefix()); 108 test2->Add(Symbols::GetterPrefix());
111 EXPECT((*test2)[0].raw() == Symbols::GetterPrefix().raw()); 109 EXPECT((*test2)[0].raw() == Symbols::GetterPrefix().raw());
112 EXPECT_EQ(1, test2->length()); 110 EXPECT_EQ(1, test2->length());
113 } 111 }
114 112
115 } // namespace dart 113 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/growable_array.h ('k') | runtime/vm/guard_field_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698