| 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_native_api.h" | 8 #include "include/dart_native_api.h" |
| 9 | 9 |
| 10 #include "platform/globals.h" | 10 #include "platform/globals.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // The UNIT_TEST_CASE macro is used for tests that do not need any | 23 // The UNIT_TEST_CASE macro is used for tests that do not need any |
| 24 // default isolate or zone functionality. | 24 // default isolate or zone functionality. |
| 25 #define UNIT_TEST_CASE(name) \ | 25 #define UNIT_TEST_CASE(name) \ |
| 26 void Dart_Test##name(); \ | 26 void Dart_Test##name(); \ |
| 27 static const dart::TestCase kRegister##name(Dart_Test##name, #name); \ | 27 static const dart::TestCase kRegister##name(Dart_Test##name, #name); \ |
| 28 void Dart_Test##name() | 28 void Dart_Test##name() |
| 29 | 29 |
| 30 // The TEST_CASE macro is used for tests that need an isolate and zone | 30 // The TEST_CASE macro is used for tests that need an isolate and zone |
| 31 // in order to test its functionality. | 31 // in order to test its functionality. |
| 32 #define TEST_CASE(name) \ | 32 #define TEST_CASE(name) \ |
| 33 static void Dart_TestHelper##name(); \ | 33 static void Dart_TestHelper##name(Thread* thread); \ |
| 34 UNIT_TEST_CASE(name) \ | 34 UNIT_TEST_CASE(name) \ |
| 35 { \ | 35 { \ |
| 36 TestIsolateScope __test_isolate__; \ | 36 TestIsolateScope __test_isolate__; \ |
| 37 Thread* __thread__ = Thread::Current(); \ | 37 Thread* __thread__ = Thread::Current(); \ |
| 38 ASSERT(__thread__->isolate() == __test_isolate__.isolate()); \ | 38 ASSERT(__thread__->isolate() == __test_isolate__.isolate()); \ |
| 39 StackZone __zone__(__thread__); \ | 39 StackZone __zone__(__thread__); \ |
| 40 HandleScope __hs__(__thread__); \ | 40 HandleScope __hs__(__thread__); \ |
| 41 Dart_TestHelper##name(); \ | 41 Dart_TestHelper##name(__thread__); \ |
| 42 } \ | 42 } \ |
| 43 static void Dart_TestHelper##name() | 43 static void Dart_TestHelper##name(Thread* thread) |
| 44 | 44 |
| 45 // The ASSEMBLER_TEST_GENERATE macro is used to generate a unit test | 45 // The ASSEMBLER_TEST_GENERATE macro is used to generate a unit test |
| 46 // for the assembler. | 46 // for the assembler. |
| 47 #define ASSEMBLER_TEST_GENERATE(name, assembler) \ | 47 #define ASSEMBLER_TEST_GENERATE(name, assembler) \ |
| 48 void AssemblerTestGenerate##name(Assembler* assembler) | 48 void AssemblerTestGenerate##name(Assembler* assembler) |
| 49 | 49 |
| 50 // The ASSEMBLER_TEST_EXTERN macro is used to declare a unit test | 50 // The ASSEMBLER_TEST_EXTERN macro is used to declare a unit test |
| 51 // for the assembler. | 51 // for the assembler. |
| 52 #define ASSEMBLER_TEST_EXTERN(name) \ | 52 #define ASSEMBLER_TEST_EXTERN(name) \ |
| 53 extern void AssemblerTestGenerate##name(Assembler* assembler); | 53 extern void AssemblerTestGenerate##name(Assembler* assembler); |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 } \ | 517 } \ |
| 518 } else { \ | 518 } else { \ |
| 519 dart::Expect(__FILE__, __LINE__).Fail("expected True, but was '%s'\n", \ | 519 dart::Expect(__FILE__, __LINE__).Fail("expected True, but was '%s'\n", \ |
| 520 #handle); \ | 520 #handle); \ |
| 521 } \ | 521 } \ |
| 522 } while (0) | 522 } while (0) |
| 523 | 523 |
| 524 } // namespace dart | 524 } // namespace dart |
| 525 | 525 |
| 526 #endif // VM_UNIT_TEST_H_ | 526 #endif // VM_UNIT_TEST_H_ |
| OLD | NEW |