| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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/object_graph.h" | 6 #include "vm/object_graph.h" |
| 7 #include "vm/unit_test.h" | 7 #include "vm/unit_test.h" |
| 8 | 8 |
| 9 namespace dart { | 9 namespace dart { |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 int size() const { return size_; } | 31 int size() const { return size_; } |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 int count_; | 34 int count_; |
| 35 intptr_t size_; | 35 intptr_t size_; |
| 36 RawObject* skip_; | 36 RawObject* skip_; |
| 37 RawObject* expected_parent_; | 37 RawObject* expected_parent_; |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 | 40 |
| 41 TEST_CASE(ObjectGraph) { | 41 VM_TEST_CASE(ObjectGraph) { |
| 42 Isolate* isolate = thread->isolate(); | 42 Isolate* isolate = thread->isolate(); |
| 43 // Create a simple object graph with objects a, b, c, d: | 43 // Create a simple object graph with objects a, b, c, d: |
| 44 // a+->b+->c | 44 // a+->b+->c |
| 45 // + + | 45 // + + |
| 46 // | v | 46 // | v |
| 47 // +-->d | 47 // +-->d |
| 48 Array& a = Array::Handle(Array::New(12, Heap::kNew)); | 48 Array& a = Array::Handle(Array::New(12, Heap::kNew)); |
| 49 Array& b = Array::Handle(Array::New(2, Heap::kOld)); | 49 Array& b = Array::Handle(Array::New(2, Heap::kOld)); |
| 50 Array& c = Array::Handle(Array::New(0, Heap::kOld)); | 50 Array& c = Array::Handle(Array::New(0, Heap::kOld)); |
| 51 Array& d = Array::Handle(Array::New(0, Heap::kOld)); | 51 Array& d = Array::Handle(Array::New(0, Heap::kOld)); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 Array& expected_a = Array::Handle(); | 132 Array& expected_a = Array::Handle(); |
| 133 expected_a ^= path.At(4); | 133 expected_a ^= path.At(4); |
| 134 EXPECT(expected_c.raw() == c.raw()); | 134 EXPECT(expected_c.raw() == c.raw()); |
| 135 EXPECT(expected_b.raw() == a.At(10)); | 135 EXPECT(expected_b.raw() == a.At(10)); |
| 136 EXPECT(expected_a.raw() == a.raw()); | 136 EXPECT(expected_a.raw() == a.raw()); |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace dart | 141 } // namespace dart |
| OLD | NEW |