| 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 |
| 3 | // BSD-style license that can be found in the LICENSE file. |
| 4 | |
| 5 | #include "vm/heap/scavenger.h" |
| 6 | #include "platform/assert.h" |
| 7 | #include "vm/unit_test.h" |
| 8 | #include "vm/visitor.h" |
| 9 | |
| 10 | namespace dart { |
| 11 | |
| 12 | // Expects to visit no objects (since the space should be empty). |
| 13 | class FailingObjectVisitor : public ObjectVisitor { |
| 14 | public: |
| 15 | FailingObjectVisitor() {} |
| 16 | virtual void VisitObject(ObjectPtr obj) { EXPECT(false); } |
| 17 | }; |
| 18 | |
| 19 | // Expects to visit no objects (since the space should be empty). |
| 20 | class FailingObjectPointerVisitor : public ObjectPointerVisitor { |
| 21 | public: |
| 22 | FailingObjectPointerVisitor() : ObjectPointerVisitor(NULL) {} |
| 23 | virtual void VisitPointers(ObjectPtr* first, ObjectPtr* last) { |
| 24 | EXPECT(false); |
| 25 | } |
| 26 | }; |
| 27 | |
| 28 | // Expects to visit no objects (since the space should be empty). |
| 29 | class FailingFindObjectVisitor : public FindObjectVisitor { |
| 30 | public: |
| 31 | FailingFindObjectVisitor() {} |
| 32 | virtual bool FindObject(ObjectPtr obj) const { |
| 33 | EXPECT(false); |
| 34 | return false; |
| 35 | } |
| 36 | }; |
| 37 | |
| 38 | } // namespace dart |
| 39 | |