OLD | NEW |
| (Empty) |
1 // Copyright 2014 the V8 project authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef V8_COMPILER_UNITTESTS_COMPILER_UNITTESTS_H_ | |
6 #define V8_COMPILER_UNITTESTS_COMPILER_UNITTESTS_H_ | |
7 | |
8 #include "include/v8.h" | |
9 #include "src/zone.h" | |
10 #include "testing/gtest-support.h" | |
11 | |
12 namespace v8 { | |
13 namespace internal { | |
14 | |
15 // Forward declarations. | |
16 class Factory; | |
17 | |
18 | |
19 namespace compiler { | |
20 | |
21 // The TARGET_TEST(Case, Name) macro works just like | |
22 // TEST(Case, Name), except that the test is disabled | |
23 // if the platform is not a supported TurboFan target. | |
24 #if V8_TURBOFAN_TARGET | |
25 #define TARGET_TEST(Case, Name) TEST(Case, Name) | |
26 #else | |
27 #define TARGET_TEST(Case, Name) TEST(Case, DISABLED_##Name) | |
28 #endif | |
29 | |
30 | |
31 // The TARGET_TEST_F(Case, Name) macro works just like | |
32 // TEST_F(Case, Name), except that the test is disabled | |
33 // if the platform is not a supported TurboFan target. | |
34 #if V8_TURBOFAN_TARGET | |
35 #define TARGET_TEST_F(Case, Name) TEST_F(Case, Name) | |
36 #else | |
37 #define TARGET_TEST_F(Case, Name) TEST_F(Case, DISABLED_##Name) | |
38 #endif | |
39 | |
40 | |
41 // The TARGET_TEST_P(Case, Name) macro works just like | |
42 // TEST_P(Case, Name), except that the test is disabled | |
43 // if the platform is not a supported TurboFan target. | |
44 #if V8_TURBOFAN_TARGET | |
45 #define TARGET_TEST_P(Case, Name) TEST_P(Case, Name) | |
46 #else | |
47 #define TARGET_TEST_P(Case, Name) TEST_P(Case, DISABLED_##Name) | |
48 #endif | |
49 | |
50 | |
51 // The TARGET_TYPED_TEST(Case, Name) macro works just like | |
52 // TYPED_TEST(Case, Name), except that the test is disabled | |
53 // if the platform is not a supported TurboFan target. | |
54 #if V8_TURBOFAN_TARGET | |
55 #define TARGET_TYPED_TEST(Case, Name) TYPED_TEST(Case, Name) | |
56 #else | |
57 #define TARGET_TYPED_TEST(Case, Name) TYPED_TEST(Case, DISABLED_##Name) | |
58 #endif | |
59 | |
60 | |
61 class CompilerTest : public ::testing::Test { | |
62 public: | |
63 CompilerTest(); | |
64 virtual ~CompilerTest(); | |
65 | |
66 Factory* factory() const; | |
67 Isolate* isolate() const { return reinterpret_cast<Isolate*>(isolate_); } | |
68 Zone* zone() { return &zone_; } | |
69 | |
70 static void SetUpTestCase(); | |
71 static void TearDownTestCase(); | |
72 | |
73 private: | |
74 static v8::Isolate* isolate_; | |
75 v8::Isolate::Scope isolate_scope_; | |
76 v8::HandleScope handle_scope_; | |
77 v8::Context::Scope context_scope_; | |
78 Zone zone_; | |
79 }; | |
80 | |
81 | |
82 template <typename T> | |
83 class CompilerTestWithParam : public CompilerTest, | |
84 public ::testing::WithParamInterface<T> {}; | |
85 | |
86 } // namespace compiler | |
87 } // namespace internal | |
88 } // namespace v8 | |
89 | |
90 #endif // V8_COMPILER_UNITTESTS_COMPILER_UNITTESTS_H_ | |
OLD | NEW |