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

Side by Side Diff: runtime/vm/hash_map_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/hash_map.h ('k') | runtime/vm/hash_table.h » ('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/unit_test.h" 6 #include "vm/unit_test.h"
7 #include "vm/hash_map.h" 7 #include "vm/hash_map.h"
8 8
9 namespace dart { 9 namespace dart {
10 10
11 class TestValue { 11 class TestValue {
12 public: 12 public:
13 explicit TestValue(intptr_t x) : x_(x) { } 13 explicit TestValue(intptr_t x) : x_(x) {}
14 intptr_t Hashcode() const { return x_ & 1; } 14 intptr_t Hashcode() const { return x_ & 1; }
15 bool Equals(TestValue* other) { return x_ == other->x_; } 15 bool Equals(TestValue* other) { return x_ == other->x_; }
16
16 private: 17 private:
17 intptr_t x_; 18 intptr_t x_;
18 }; 19 };
19 20
20 21
21 TEST_CASE(DirectChainedHashMap) { 22 TEST_CASE(DirectChainedHashMap) {
22 DirectChainedHashMap<PointerKeyValueTrait<TestValue> > map; 23 DirectChainedHashMap<PointerKeyValueTrait<TestValue> > map;
23 EXPECT(map.IsEmpty()); 24 EXPECT(map.IsEmpty());
24 TestValue v1(0); 25 TestValue v1(0);
25 TestValue v2(1); 26 TestValue v2(1);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 110 }
110 count++; 111 count++;
111 sum += p->second(); 112 sum += p->second();
112 } 113 }
113 114
114 EXPECT(count == 5); 115 EXPECT(count == 5);
115 EXPECT(sum == 15); 116 EXPECT(sum == 15);
116 } 117 }
117 118
118 } // namespace dart 119 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/hash_map.h ('k') | runtime/vm/hash_table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698