Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
1d8c5af3
Commit
1d8c5af3
authored
Mar 29, 2011
by
vladlosev
Browse files
Allows Google Mock to compile on platforms that do not support typed tests.
parent
5017fe00
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
32 deletions
+36
-32
include/gtest/internal/gtest-type-util.h
include/gtest/internal/gtest-type-util.h
+18
-16
include/gtest/internal/gtest-type-util.h.pump
include/gtest/internal/gtest-type-util.h.pump
+18
-16
No files found.
include/gtest/internal/gtest-type-util.h
View file @
1d8c5af3
...
...
@@ -47,8 +47,6 @@
#include "gtest/internal/gtest-port.h"
#include "gtest/internal/gtest-string.h"
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
// #ifdef __GNUC__ is too general here. It is possible to use gcc without using
// libstdc++ (which is where cxxabi.h comes from).
# ifdef __GLIBCXX__
...
...
@@ -58,19 +56,9 @@
namespace testing {
namespace internal {
// AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same
// type. This can be used as a compile-time assertion to ensure that
// two types are equal.
template
<
typename
T1
,
typename
T2
>
struct
AssertTypeEq
;
template
<
typename
T
>
struct
AssertTypeEq
<
T
,
T
>
{
typedef
bool
type
;
};
// GetTypeName<T>() returns a human-readable name of type T.
// NB: This function is also used in Google Mock, so don't move it inside of
// the typed-test-only section below.
template <typename T>
String GetTypeName() {
# if GTEST_HAS_RTTI
...
...
@@ -95,6 +83,20 @@ String GetTypeName() {
# endif // GTEST_HAS_RTTI
}
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
// AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same
// type. This can be used as a compile-time assertion to ensure that
// two types are equal.
template <typename T1, typename T2>
struct AssertTypeEq;
template <typename T>
struct AssertTypeEq<T, T> {
typedef bool type;
};
// A unique type used as the default value for the arguments of class
// template Types. This allows us to simulate variadic templates
// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't
...
...
@@ -3315,9 +3317,9 @@ struct TypeList<Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13,
T41, T42, T43, T44, T45, T46, T47, T48, T49, T50>::type type;
};
#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
} // namespace internal
} // namespace testing
#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
include/gtest/internal/gtest-type-util.h.pump
View file @
1d8c5af3
...
...
@@ -45,8 +45,6 @@ $var n = 50 $$ Maximum length of type lists we want to support.
#include "gtest/internal/gtest-port.h"
#include "gtest/internal/gtest-string.h"
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
// #ifdef __GNUC__ is too general here. It is possible to use gcc without using
// libstdc++ (which is where cxxabi.h comes from).
# ifdef __GLIBCXX__
...
...
@@ -56,19 +54,9 @@ $var n = 50 $$ Maximum length of type lists we want to support.
namespace
testing
{
namespace
internal
{
// AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same
// type. This can be used as a compile-time assertion to ensure that
// two types are equal.
template
<
typename
T1
,
typename
T2
>
struct
AssertTypeEq
;
template
<
typename
T
>
struct
AssertTypeEq
<
T
,
T
>
{
typedef
bool
type
;
};
// GetTypeName<T>() returns a human-readable name of type T.
// NB: This function is also used in Google Mock, so don't move it inside of
// the typed-test-only section below.
template
<
typename
T
>
String
GetTypeName
()
{
# if GTEST_HAS_RTTI
...
...
@@ -93,6 +81,20 @@ String GetTypeName() {
# endif // GTEST_HAS_RTTI
}
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
// AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same
// type. This can be used as a compile-time assertion to ensure that
// two types are equal.
template
<
typename
T1
,
typename
T2
>
struct
AssertTypeEq
;
template
<
typename
T
>
struct
AssertTypeEq
<
T
,
T
>
{
typedef
bool
type
;
};
// A unique type used as the default value for the arguments of class
// template Types. This allows us to simulate variadic templates
// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't
...
...
@@ -281,9 +283,9 @@ struct TypeList<Types<$for i, [[T$i]]> > {
typedef
typename
Types
<
$
for
i
,
[[
T
$
i
]]
>::
type
type
;
};
#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
}
// namespace internal
}
// namespace testing
#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment