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

Side by Side Diff: runtime/vm/unit_test.h

Issue 12315087: Hook up simulator (if needed) when calling Dart code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 months 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/stub_code_x64_test.cc ('k') | no next file » | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 #ifndef VM_UNIT_TEST_H_ 5 #ifndef VM_UNIT_TEST_H_
6 #define VM_UNIT_TEST_H_ 6 #define VM_UNIT_TEST_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 9
10 #include "vm/ast.h" 10 #include "vm/ast.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 #define CODEGEN_TEST_RUN(name, expected) \ 77 #define CODEGEN_TEST_RUN(name, expected) \
78 static void CodeGenTestRun##name(const Function& function); \ 78 static void CodeGenTestRun##name(const Function& function); \
79 TEST_CASE(name) { \ 79 TEST_CASE(name) { \
80 CodeGenTest __test__(""#name); \ 80 CodeGenTest __test__(""#name); \
81 CodeGenTestGenerate##name(&__test__); \ 81 CodeGenTestGenerate##name(&__test__); \
82 __test__.Compile(); \ 82 __test__.Compile(); \
83 CodeGenTestRun##name(__test__.function()); \ 83 CodeGenTestRun##name(__test__.function()); \
84 } \ 84 } \
85 static void CodeGenTestRun##name(const Function& function) { \ 85 static void CodeGenTestRun##name(const Function& function) { \
86 Object& result = Object::Handle(); \ 86 Object& result = Object::Handle(); \
87 result = DartEntry::InvokeStatic(function, Object::empty_array()); \ 87 result = DartEntry::InvokeFunction(function, Object::empty_array()); \
88 EXPECT(!result.IsError()); \ 88 EXPECT(!result.IsError()); \
89 Instance& actual = Instance::Handle(); \ 89 Instance& actual = Instance::Handle(); \
90 actual ^= result.raw(); \ 90 actual ^= result.raw(); \
91 EXPECT(actual.Equals(Instance::Handle(expected))); \ 91 EXPECT(actual.Equals(Instance::Handle(expected))); \
92 } 92 }
93 93
94 94
95 // Pass the name of test, and use the generated function to call it 95 // Pass the name of test, and use the generated function to call it
96 // and evaluate its result. 96 // and evaluate its result.
97 #define CODEGEN_TEST_RAW_RUN(name, function) \ 97 #define CODEGEN_TEST_RAW_RUN(name, function) \
(...skipping 17 matching lines...) Expand all
115 CodeGenTestGenerate##name2(&__test2__); \ 115 CodeGenTestGenerate##name2(&__test2__); \
116 __test2__.Compile(); \ 116 __test2__.Compile(); \
117 /* Generate code for name1, providing function2 */ \ 117 /* Generate code for name1, providing function2 */ \
118 CodeGenTest __test1__(""#name1); \ 118 CodeGenTest __test1__(""#name1); \
119 CodeGenTestGenerate##name1(__test2__.function(), &__test1__); \ 119 CodeGenTestGenerate##name1(__test2__.function(), &__test1__); \
120 __test1__.Compile(); \ 120 __test1__.Compile(); \
121 CodeGenTestRun##name1(__test1__.function()); \ 121 CodeGenTestRun##name1(__test1__.function()); \
122 } \ 122 } \
123 static void CodeGenTestRun##name1(const Function& function) { \ 123 static void CodeGenTestRun##name1(const Function& function) { \
124 Object& result = Object::Handle(); \ 124 Object& result = Object::Handle(); \
125 result = DartEntry::InvokeStatic(function, Object::empty_array()); \ 125 result = DartEntry::InvokeFunction(function, Object::empty_array()); \
126 EXPECT(!result.IsError()); \ 126 EXPECT(!result.IsError()); \
127 Instance& actual = Instance::Handle(); \ 127 Instance& actual = Instance::Handle(); \
128 actual ^= result.raw(); \ 128 actual ^= result.raw(); \
129 EXPECT(actual.Equals(Instance::Handle(expected))); \ 129 EXPECT(actual.Equals(Instance::Handle(expected))); \
130 } 130 }
131 131
132 132
133 #if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS) 133 #if defined(TARGET_ARCH_ARM) || defined(TARGET_ARCH_MIPS)
134 #if defined(HOST_ARCH_ARM) || defined(HOST_ARCH_MIPS) 134 #if defined(HOST_ARCH_ARM) || defined(HOST_ARCH_MIPS)
135 // Running on actual ARM or MIPS hardware, execute code natively. 135 // Running on actual ARM or MIPS hardware, execute code natively.
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 } else { \ 357 } else { \
358 dart::Expect(__FILE__, __LINE__).Fail( \ 358 dart::Expect(__FILE__, __LINE__).Fail( \
359 "expected '%s' to be an error handle but found a valid handle.\n", \ 359 "expected '%s' to be an error handle but found a valid handle.\n", \
360 #handle); \ 360 #handle); \
361 } \ 361 } \
362 } while (0) 362 } while (0)
363 363
364 } // namespace dart 364 } // namespace dart
365 365
366 #endif // VM_UNIT_TEST_H_ 366 #endif // VM_UNIT_TEST_H_
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_x64_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698