OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_TESTING_GTEST_SUPPORT_H_ | 5 #ifndef V8_TESTING_GTEST_SUPPORT_H_ |
6 #define V8_TESTING_GTEST_SUPPORT_H_ | 6 #define V8_TESTING_GTEST_SUPPORT_H_ |
7 | 7 |
8 #include "include/v8stdint.h" | 8 #include "include/v8stdint.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 namespace testing { | 11 namespace testing { |
12 namespace internal { | 12 namespace internal { |
13 | 13 |
14 #define GET_TYPE_NAME(type) \ | 14 #define GET_TYPE_NAME(type) \ |
15 template <> \ | 15 template <> \ |
16 inline std::string GetTypeName<type>() { \ | 16 inline std::string GetTypeName<type>() { \ |
17 return #type; \ | 17 return #type; \ |
18 } | 18 } |
19 GET_TYPE_NAME(int8_t) | 19 GET_TYPE_NAME(bool) |
20 GET_TYPE_NAME(uint8_t) | 20 GET_TYPE_NAME(signed char) |
21 GET_TYPE_NAME(int16_t) | 21 GET_TYPE_NAME(unsigned char) |
22 GET_TYPE_NAME(uint16_t) | 22 GET_TYPE_NAME(short) |
23 GET_TYPE_NAME(int32_t) | 23 GET_TYPE_NAME(unsigned short) |
24 GET_TYPE_NAME(uint32_t) | 24 GET_TYPE_NAME(int) |
25 GET_TYPE_NAME(int64_t) | 25 GET_TYPE_NAME(unsigned int) |
26 GET_TYPE_NAME(uint64_t) | 26 GET_TYPE_NAME(long) |
| 27 GET_TYPE_NAME(unsigned long) |
| 28 GET_TYPE_NAME(long long) |
| 29 GET_TYPE_NAME(unsigned long long) |
27 GET_TYPE_NAME(float) | 30 GET_TYPE_NAME(float) |
28 GET_TYPE_NAME(double) | 31 GET_TYPE_NAME(double) |
29 #undef GET_TYPE_NAME | 32 #undef GET_TYPE_NAME |
30 | 33 |
31 | 34 |
32 // TRACED_FOREACH(type, var, array) expands to a loop that assigns |var| every | 35 // TRACED_FOREACH(type, var, array) expands to a loop that assigns |var| every |
33 // item in the |array| and adds a SCOPED_TRACE() message for the |var| while | 36 // item in the |array| and adds a SCOPED_TRACE() message for the |var| while |
34 // inside the loop body. | 37 // inside the loop body. |
35 // TODO(bmeurer): Migrate to C++11 once we're ready. | 38 // TODO(bmeurer): Migrate to C++11 once we're ready. |
36 #define TRACED_FOREACH(_type, _var, _array) \ | 39 #define TRACED_FOREACH(_type, _var, _array) \ |
(...skipping 12 matching lines...) Expand all Loading... |
49 for (_type _i = _low; _i <= _high; ++_i) \ | 52 for (_type _i = _low; _i <= _high; ++_i) \ |
50 for (bool _done = false; !_done;) \ | 53 for (bool _done = false; !_done;) \ |
51 for (_type const _var = _i; !_done;) \ | 54 for (_type const _var = _i; !_done;) \ |
52 for (SCOPED_TRACE(::testing::Message() << #_var << " = " << _var); \ | 55 for (SCOPED_TRACE(::testing::Message() << #_var << " = " << _var); \ |
53 !_done; _done = true) | 56 !_done; _done = true) |
54 | 57 |
55 } // namespace internal | 58 } // namespace internal |
56 } // namespace testing | 59 } // namespace testing |
57 | 60 |
58 #endif // V8_TESTING_GTEST_SUPPORT_H_ | 61 #endif // V8_TESTING_GTEST_SUPPORT_H_ |
OLD | NEW |