Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
1d8c5af3
Commit
1d8c5af3
authored
Mar 29, 2011
by
vladlosev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allows Google Mock to compile on platforms that do not support typed tests.
parent
5017fe00
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
32 deletions
+36
-32
gtest-type-util.h
include/gtest/internal/gtest-type-util.h
+18
-16
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 @@
...
@@ -47,8 +47,6 @@
#include "gtest/internal/gtest-port.h"
#include "gtest/internal/gtest-port.h"
#include "gtest/internal/gtest-string.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
// #ifdef __GNUC__ is too general here. It is possible to use gcc without using
// libstdc++ (which is where cxxabi.h comes from).
// libstdc++ (which is where cxxabi.h comes from).
# ifdef __GLIBCXX__
# ifdef __GLIBCXX__
...
@@ -58,19 +56,9 @@
...
@@ -58,19 +56,9 @@
namespace
testing
{
namespace
testing
{
namespace
internal
{
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.
// 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
>
template
<
typename
T
>
String
GetTypeName
()
{
String
GetTypeName
()
{
# if GTEST_HAS_RTTI
# if GTEST_HAS_RTTI
...
@@ -95,6 +83,20 @@ String GetTypeName() {
...
@@ -95,6 +83,20 @@ String GetTypeName() {
# endif // GTEST_HAS_RTTI
# 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
// A unique type used as the default value for the arguments of class
// template Types. This allows us to simulate variadic templates
// template Types. This allows us to simulate variadic templates
// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't
// (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,
...
@@ -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
;
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 internal
}
// namespace testing
}
// namespace testing
#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
#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.
...
@@ -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-port.h"
#include "gtest/internal/gtest-string.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
// #ifdef __GNUC__ is too general here. It is possible to use gcc without using
// libstdc++ (which is where cxxabi.h comes from).
// libstdc++ (which is where cxxabi.h comes from).
# ifdef __GLIBCXX__
# ifdef __GLIBCXX__
...
@@ -56,19 +54,9 @@ $var n = 50 $$ Maximum length of type lists we want to support.
...
@@ -56,19 +54,9 @@ $var n = 50 $$ Maximum length of type lists we want to support.
namespace
testing
{
namespace
testing
{
namespace
internal
{
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.
// 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
>
template
<
typename
T
>
String
GetTypeName
()
{
String
GetTypeName
()
{
# if GTEST_HAS_RTTI
# if GTEST_HAS_RTTI
...
@@ -93,6 +81,20 @@ String GetTypeName() {
...
@@ -93,6 +81,20 @@ String GetTypeName() {
# endif // GTEST_HAS_RTTI
# 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
// A unique type used as the default value for the arguments of class
// template Types. This allows us to simulate variadic templates
// template Types. This allows us to simulate variadic templates
// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't
// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't
...
@@ -281,9 +283,9 @@ struct TypeList<Types<$for i, [[T$i]]> > {
...
@@ -281,9 +283,9 @@ struct TypeList<Types<$for i, [[T$i]]> > {
typedef
typename
Types
<
$
for
i
,
[[
T
$
i
]]
>::
type
type
;
typedef
typename
Types
<
$
for
i
,
[[
T
$
i
]]
>::
type
type
;
};
};
#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
}
// namespace internal
}
// namespace internal
}
// namespace testing
}
// namespace testing
#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
#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