| OLD | NEW |
| 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 22 matching lines...) Expand all Loading... |
| 33 TestIsolateScope __test_isolate__; \ | 33 TestIsolateScope __test_isolate__; \ |
| 34 Zone __zone__(__test_isolate__.isolate()); \ | 34 Zone __zone__(__test_isolate__.isolate()); \ |
| 35 HandleScope __hs__(__test_isolate__.isolate()); \ | 35 HandleScope __hs__(__test_isolate__.isolate()); \ |
| 36 Dart_TestHelper##name(); \ | 36 Dart_TestHelper##name(); \ |
| 37 } \ | 37 } \ |
| 38 static void Dart_TestHelper##name() | 38 static void Dart_TestHelper##name() |
| 39 | 39 |
| 40 // The ASSEMBLER_TEST_GENERATE macro is used to generate a unit test | 40 // The ASSEMBLER_TEST_GENERATE macro is used to generate a unit test |
| 41 // for the assembler. | 41 // for the assembler. |
| 42 #define ASSEMBLER_TEST_GENERATE(name, assembler) \ | 42 #define ASSEMBLER_TEST_GENERATE(name, assembler) \ |
| 43 static void AssemblerTestGenerate##name(Assembler* assembler) | 43 void AssemblerTestGenerate##name(Assembler* assembler) |
| 44 |
| 45 // The ASSEMBLER_TEST_EXTERN macro is used to declare a unit test |
| 46 // for the assembler. |
| 47 #define ASSEMBLER_TEST_EXTERN(name) \ |
| 48 extern void AssemblerTestGenerate##name(Assembler* assembler); |
| 44 | 49 |
| 45 // The ASSEMBLER_TEST_RUN macro is used to execute the assembler unit | 50 // The ASSEMBLER_TEST_RUN macro is used to execute the assembler unit |
| 46 // test generated using the ASSEMBLER_TEST_GENERATE macro. | 51 // test generated using the ASSEMBLER_TEST_GENERATE macro. |
| 47 // C++ callee-saved registers are not preserved. Arguments may be passed in. | 52 // C++ callee-saved registers are not preserved. Arguments may be passed in. |
| 48 #define ASSEMBLER_TEST_RUN(name, entry) \ | 53 #define ASSEMBLER_TEST_RUN(name, entry) \ |
| 49 static void AssemblerTestRun##name(uword entry); \ | 54 static void AssemblerTestRun##name(uword entry); \ |
| 50 TEST_CASE(name) { \ | 55 TEST_CASE(name) { \ |
| 51 Assembler __assembler__; \ | 56 Assembler __assembler__; \ |
| 52 AssemblerTest __test__(""#name, &__assembler__); \ | 57 AssemblerTest __test__(""#name, &__assembler__); \ |
| 53 AssemblerTestGenerate##name(__test__.assembler()); \ | 58 AssemblerTestGenerate##name(__test__.assembler()); \ |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 } else { \ | 309 } else { \ |
| 305 dart::Expect(__FILE__, __LINE__).Fail( \ | 310 dart::Expect(__FILE__, __LINE__).Fail( \ |
| 306 "expected '%s' to be an error handle but found a valid handle.\n", \ | 311 "expected '%s' to be an error handle but found a valid handle.\n", \ |
| 307 #handle); \ | 312 #handle); \ |
| 308 } \ | 313 } \ |
| 309 } while (0) | 314 } while (0) |
| 310 | 315 |
| 311 } // namespace dart | 316 } // namespace dart |
| 312 | 317 |
| 313 #endif // VM_UNIT_TEST_H_ | 318 #endif // VM_UNIT_TEST_H_ |
| OLD | NEW |