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
cc265df8
Commit
cc265df8
authored
Jun 13, 2011
by
vladlosev
Browse files
Fixes broken build on VC++ 7.1.
parent
7e29bb7f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
101 additions
and
43 deletions
+101
-43
CMakeLists.txt
CMakeLists.txt
+24
-14
cmake/internal_utils.cmake
cmake/internal_utils.cmake
+10
-0
include/gtest/gtest-printers.h
include/gtest/gtest-printers.h
+4
-1
include/gtest/internal/gtest-internal.h
include/gtest/internal/gtest-internal.h
+10
-0
test/gtest_throw_on_failure_test_.cc
test/gtest_throw_on_failure_test_.cc
+17
-1
test/gtest_xml_output_unittest.py
test/gtest_xml_output_unittest.py
+30
-24
test/gtest_xml_output_unittest_.cc
test/gtest_xml_output_unittest_.cc
+6
-3
No files found.
CMakeLists.txt
View file @
cc265df8
...
@@ -140,10 +140,13 @@ if (gtest_build_tests)
...
@@ -140,10 +140,13 @@ if (gtest_build_tests)
############################################################
############################################################
# C++ tests built with non-standard compiler flags.
# C++ tests built with non-standard compiler flags.
cxx_library
(
gtest_no_exception
"
${
cxx_no_exception
}
"
# MSVC 7.1 does not support STL with exceptions disabled.
src/gtest-all.cc
)
if
(
NOT MSVC OR MSVC_VERSION GREATER 1310
)
cxx_library
(
gtest_main_no_exception
"
${
cxx_no_exception
}
"
cxx_library
(
gtest_no_exception
"
${
cxx_no_exception
}
"
src/gtest-all.cc src/gtest_main.cc
)
src/gtest-all.cc
)
cxx_library
(
gtest_main_no_exception
"
${
cxx_no_exception
}
"
src/gtest-all.cc src/gtest_main.cc
)
endif
()
cxx_library
(
gtest_main_no_rtti
"
${
cxx_no_rtti
}
"
cxx_library
(
gtest_main_no_rtti
"
${
cxx_no_rtti
}
"
src/gtest-all.cc src/gtest_main.cc
)
src/gtest-all.cc src/gtest_main.cc
)
...
@@ -189,11 +192,15 @@ if (gtest_build_tests)
...
@@ -189,11 +192,15 @@ if (gtest_build_tests)
cxx_executable
(
gtest_break_on_failure_unittest_ test gtest
)
cxx_executable
(
gtest_break_on_failure_unittest_ test gtest
)
py_test
(
gtest_break_on_failure_unittest
)
py_test
(
gtest_break_on_failure_unittest
)
cxx_executable_with_flags
(
# MSVC 7.1 does not support STL with exceptions disabled.
gtest_catch_exceptions_no_ex_test_
if
(
NOT MSVC OR MSVC_VERSION GREATER 1310
)
"
${
cxx_no_exception
}
"
cxx_executable_with_flags
(
gtest_main_no_exception
gtest_catch_exceptions_no_ex_test_
test/gtest_catch_exceptions_test_.cc
)
"
${
cxx_no_exception
}
"
gtest_main_no_exception
test/gtest_catch_exceptions_test_.cc
)
endif
()
cxx_executable_with_flags
(
cxx_executable_with_flags
(
gtest_catch_exceptions_ex_test_
gtest_catch_exceptions_ex_test_
"
${
cxx_exception
}
"
"
${
cxx_exception
}
"
...
@@ -222,11 +229,14 @@ if (gtest_build_tests)
...
@@ -222,11 +229,14 @@ if (gtest_build_tests)
cxx_executable
(
gtest_shuffle_test_ test gtest
)
cxx_executable
(
gtest_shuffle_test_ test gtest
)
py_test
(
gtest_shuffle_test
)
py_test
(
gtest_shuffle_test
)
cxx_executable
(
gtest_throw_on_failure_test_ test gtest_no_exception
)
# MSVC 7.1 does not support STL with exceptions disabled.
set_target_properties
(
gtest_throw_on_failure_test_
if
(
NOT MSVC OR MSVC_VERSION GREATER 1310
)
PROPERTIES
cxx_executable
(
gtest_throw_on_failure_test_ test gtest_no_exception
)
COMPILE_FLAGS
"
${
cxx_no_exception
}
"
)
set_target_properties
(
gtest_throw_on_failure_test_
py_test
(
gtest_throw_on_failure_test
)
PROPERTIES
COMPILE_FLAGS
"
${
cxx_no_exception
}
"
)
py_test
(
gtest_throw_on_failure_test
)
endif
()
cxx_executable
(
gtest_uninitialized_test_ test gtest
)
cxx_executable
(
gtest_uninitialized_test_ test gtest
)
py_test
(
gtest_uninitialized_test
)
py_test
(
gtest_uninitialized_test
)
...
...
cmake/internal_utils.cmake
View file @
cc265df8
...
@@ -56,6 +56,16 @@ macro(config_compiler_and_linker)
...
@@ -56,6 +56,16 @@ macro(config_compiler_and_linker)
# Newlines inside flags variables break CMake's NMake generator.
# Newlines inside flags variables break CMake's NMake generator.
# TODO(vladl@google.com): Add -RTCs and -RTCu to debug builds.
# TODO(vladl@google.com): Add -RTCs and -RTCu to debug builds.
set
(
cxx_base_flags
"-GS -W4 -WX -wd4127 -wd4251 -wd4275 -nologo -J -Zi"
)
set
(
cxx_base_flags
"-GS -W4 -WX -wd4127 -wd4251 -wd4275 -nologo -J -Zi"
)
if
(
MSVC_VERSION LESS 1400
)
# Suppress spurious warnings MSVC 7.1 sometimes issues.
# Forcing value to bool.
set
(
cxx_base_flags
"
${
cxx_base_flags
}
-wd4800"
)
# Copy constructor and assignment operator could not be generated.
set
(
cxx_base_flags
"
${
cxx_base_flags
}
-wd4511 -wd4512"
)
# Compatibility warnings not applicable to Google Test.
# Resolved overload was found by argument-dependent lookup.
set
(
cxx_base_flags
"
${
cxx_base_flags
}
-wd4675"
)
endif
()
set
(
cxx_base_flags
"
${
cxx_base_flags
}
-D_UNICODE -DUNICODE -DWIN32 -D_WIN32"
)
set
(
cxx_base_flags
"
${
cxx_base_flags
}
-D_UNICODE -DUNICODE -DWIN32 -D_WIN32"
)
set
(
cxx_base_flags
"
${
cxx_base_flags
}
-DSTRICT -DWIN32_LEAN_AND_MEAN"
)
set
(
cxx_base_flags
"
${
cxx_base_flags
}
-DSTRICT -DWIN32_LEAN_AND_MEAN"
)
set
(
cxx_exception_flags
"-EHsc -D_HAS_EXCEPTIONS=1"
)
set
(
cxx_exception_flags
"-EHsc -D_HAS_EXCEPTIONS=1"
)
...
...
include/gtest/gtest-printers.h
View file @
cc265df8
...
@@ -694,7 +694,10 @@ inline void UniversalTersePrint(char* str, ::std::ostream* os) {
...
@@ -694,7 +694,10 @@ inline void UniversalTersePrint(char* str, ::std::ostream* os) {
// NUL-terminated string.
// NUL-terminated string.
template
<
typename
T
>
template
<
typename
T
>
void
UniversalPrint
(
const
T
&
value
,
::
std
::
ostream
*
os
)
{
void
UniversalPrint
(
const
T
&
value
,
::
std
::
ostream
*
os
)
{
UniversalPrinter
<
T
>::
Print
(
value
,
os
);
// A workarond for the bug in VC++ 7.1 that prevents us from instantiating
// UniversalPrinter with T directly.
typedef
T
T1
;
UniversalPrinter
<
T1
>::
Print
(
value
,
os
);
}
}
#if GTEST_HAS_TR1_TUPLE
#if GTEST_HAS_TR1_TUPLE
...
...
include/gtest/internal/gtest-internal.h
View file @
cc265df8
...
@@ -802,6 +802,16 @@ struct RemoveConst<const T[N]> {
...
@@ -802,6 +802,16 @@ struct RemoveConst<const T[N]> {
typedef
typename
RemoveConst
<
T
>::
type
type
[
N
];
typedef
typename
RemoveConst
<
T
>::
type
type
[
N
];
};
};
#if defined(_MSC_VER) && _MSC_VER < 1400
// This is the only specialization that allows VC++ 7.1 to remove const in
// 'const int[3] and 'const int[3][4]'. However, it causes trouble with GCC
// and thus needs to be conditionally compiled.
template
<
typename
T
,
size_t
N
>
struct
RemoveConst
<
T
[
N
]
>
{
typedef
typename
RemoveConst
<
T
>::
type
type
[
N
];
};
#endif
// A handy wrapper around RemoveConst that works when the argument
// A handy wrapper around RemoveConst that works when the argument
// T depends on template parameters.
// T depends on template parameters.
#define GTEST_REMOVE_CONST_(T) \
#define GTEST_REMOVE_CONST_(T) \
...
...
test/gtest_throw_on_failure_test_.cc
View file @
cc265df8
...
@@ -37,12 +37,28 @@
...
@@ -37,12 +37,28 @@
#include "gtest/gtest.h"
#include "gtest/gtest.h"
#include <stdio.h> // for fflush, fprintf, NULL, etc.
#include <stdlib.h> // for exit
#include <exception> // for set_terminate
// This terminate handler aborts the program using exit() rather than abort().
// This avoids showing pop-ups on Windows systems and core dumps on Unix-like
// ones.
void
TerminateHandler
()
{
fprintf
(
stderr
,
"%s
\n
"
,
"Unhandled C++ exception terminating the program."
);
fflush
(
NULL
);
exit
(
1
);
}
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
#if GTEST_HAS_EXCEPTIONS
std
::
set_terminate
(
&
TerminateHandler
);
#endif
testing
::
InitGoogleTest
(
&
argc
,
argv
);
testing
::
InitGoogleTest
(
&
argc
,
argv
);
// We want to ensure that people can use Google Test assertions in
// We want to ensure that people can use Google Test assertions in
// other testing frameworks, as long as they initialize Google Test
// other testing frameworks, as long as they initialize Google Test
// properly and set the throw
n
-on-failure mode. Therefore, we don't
// properly and set the throw-on-failure mode. Therefore, we don't
// use Google Test's constructs for defining and running tests
// use Google Test's constructs for defining and running tests
// (e.g. TEST and RUN_ALL_TESTS) here.
// (e.g. TEST and RUN_ALL_TESTS) here.
...
...
test/gtest_xml_output_unittest.py
View file @
cc265df8
...
@@ -42,6 +42,7 @@ import gtest_test_utils
...
@@ -42,6 +42,7 @@ import gtest_test_utils
import
gtest_xml_test_utils
import
gtest_xml_test_utils
GTEST_LIST_TESTS_FLAG
=
'--gtest_list_tests'
GTEST_OUTPUT_FLAG
=
"--gtest_output"
GTEST_OUTPUT_FLAG
=
"--gtest_output"
GTEST_DEFAULT_OUTPUT_FILE
=
"test_detail.xml"
GTEST_DEFAULT_OUTPUT_FILE
=
"test_detail.xml"
GTEST_PROGRAM_NAME
=
"gtest_xml_output_unittest_"
GTEST_PROGRAM_NAME
=
"gtest_xml_output_unittest_"
...
@@ -49,9 +50,9 @@ GTEST_PROGRAM_NAME = "gtest_xml_output_unittest_"
...
@@ -49,9 +50,9 @@ GTEST_PROGRAM_NAME = "gtest_xml_output_unittest_"
SUPPORTS_STACK_TRACES
=
False
SUPPORTS_STACK_TRACES
=
False
if
SUPPORTS_STACK_TRACES
:
if
SUPPORTS_STACK_TRACES
:
STACK_TRACE_TEMPLATE
=
"
\n
Stack trace:
\n
*
"
STACK_TRACE_TEMPLATE
=
'
\n
Stack trace:
\n
*
'
else
:
else
:
STACK_TRACE_TEMPLATE
=
""
STACK_TRACE_TEMPLATE
=
''
EXPECTED_NON_EMPTY_XML
=
"""<?xml version="1.0" encoding="UTF-8"?>
EXPECTED_NON_EMPTY_XML
=
"""<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="23" failures="4" disabled="2" errors="0" time="*" name="AllTests">
<testsuites tests="23" failures="4" disabled="2" errors="0" time="*" name="AllTests">
...
@@ -130,18 +131,26 @@ EXPECTED_EMPTY_XML = """<?xml version="1.0" encoding="UTF-8"?>
...
@@ -130,18 +131,26 @@ EXPECTED_EMPTY_XML = """<?xml version="1.0" encoding="UTF-8"?>
<testsuites tests="0" failures="0" disabled="0" errors="0" time="*" name="AllTests">
<testsuites tests="0" failures="0" disabled="0" errors="0" time="*" name="AllTests">
</testsuites>"""
</testsuites>"""
GTEST_PROGRAM_PATH
=
gtest_test_utils
.
GetTestExecutablePath
(
GTEST_PROGRAM_NAME
)
SUPPORTS_TYPED_TESTS
=
'TypedTest'
in
gtest_test_utils
.
Subprocess
(
[
GTEST_PROGRAM_PATH
,
GTEST_LIST_TESTS_FLAG
],
capture_stderr
=
False
).
output
class
GTestXMLOutputUnitTest
(
gtest_xml_test_utils
.
GTestXMLTestCase
):
class
GTestXMLOutputUnitTest
(
gtest_xml_test_utils
.
GTestXMLTestCase
):
"""
"""
Unit test for Google Test's XML output functionality.
Unit test for Google Test's XML output functionality.
"""
"""
def
testNonEmptyXmlOutput
(
self
):
# This test currently breaks on platforms that do not support typed and
"""
# type-parameterized tests, so we don't run it under them.
Runs a test program that generates a non-empty XML output, and
if
SUPPORTS_TYPED_TESTS
:
tests that the XML output is expected.
def
testNonEmptyXmlOutput
(
self
):
"""
"""
self
.
_TestXmlOutput
(
GTEST_PROGRAM_NAME
,
EXPECTED_NON_EMPTY_XML
,
1
)
Runs a test program that generates a non-empty XML output, and
tests that the XML output is expected.
"""
self
.
_TestXmlOutput
(
GTEST_PROGRAM_NAME
,
EXPECTED_NON_EMPTY_XML
,
1
)
def
testEmptyXmlOutput
(
self
):
def
testEmptyXmlOutput
(
self
):
"""
"""
...
@@ -149,8 +158,7 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
...
@@ -149,8 +158,7 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
tests that the XML output is expected.
tests that the XML output is expected.
"""
"""
self
.
_TestXmlOutput
(
"gtest_no_test_unittest"
,
self
.
_TestXmlOutput
(
'gtest_no_test_unittest'
,
EXPECTED_EMPTY_XML
,
0
)
EXPECTED_EMPTY_XML
,
0
)
def
testDefaultOutputFile
(
self
):
def
testDefaultOutputFile
(
self
):
"""
"""
...
@@ -160,7 +168,7 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
...
@@ -160,7 +168,7 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
output_file
=
os
.
path
.
join
(
gtest_test_utils
.
GetTempDir
(),
output_file
=
os
.
path
.
join
(
gtest_test_utils
.
GetTempDir
(),
GTEST_DEFAULT_OUTPUT_FILE
)
GTEST_DEFAULT_OUTPUT_FILE
)
gtest_prog_path
=
gtest_test_utils
.
GetTestExecutablePath
(
gtest_prog_path
=
gtest_test_utils
.
GetTestExecutablePath
(
"
gtest_no_test_unittest
"
)
'
gtest_no_test_unittest
'
)
try
:
try
:
os
.
remove
(
output_file
)
os
.
remove
(
output_file
)
except
OSError
,
e
:
except
OSError
,
e
:
...
@@ -168,7 +176,7 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
...
@@ -168,7 +176,7 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
raise
raise
p
=
gtest_test_utils
.
Subprocess
(
p
=
gtest_test_utils
.
Subprocess
(
[
gtest_prog_path
,
"
%s=xml
"
%
GTEST_OUTPUT_FLAG
],
[
gtest_prog_path
,
'
%s=xml
'
%
GTEST_OUTPUT_FLAG
],
working_dir
=
gtest_test_utils
.
GetTempDir
())
working_dir
=
gtest_test_utils
.
GetTempDir
())
self
.
assert_
(
p
.
exited
)
self
.
assert_
(
p
.
exited
)
self
.
assertEquals
(
0
,
p
.
exit_code
)
self
.
assertEquals
(
0
,
p
.
exit_code
)
...
@@ -181,24 +189,22 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
...
@@ -181,24 +189,22 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
"""
"""
xml_path
=
os
.
path
.
join
(
gtest_test_utils
.
GetTempDir
(),
xml_path
=
os
.
path
.
join
(
gtest_test_utils
.
GetTempDir
(),
GTEST_PROGRAM_NAME
+
"
out.xml
"
)
GTEST_PROGRAM_NAME
+
'
out.xml
'
)
if
os
.
path
.
isfile
(
xml_path
):
if
os
.
path
.
isfile
(
xml_path
):
os
.
remove
(
xml_path
)
os
.
remove
(
xml_path
)
gtest_prog_path
=
gtest_test_utils
.
GetTestExecutablePath
(
GTEST_PROGRAM_NAME
)
command
=
[
GTEST_PROGRAM_PATH
,
'%s=xml:%s'
%
(
GTEST_OUTPUT_FLAG
,
xml_path
),
command
=
[
gtest_prog_path
,
'--shut_down_xml'
]
"%s=xml:%s"
%
(
GTEST_OUTPUT_FLAG
,
xml_path
),
"--shut_down_xml"
]
p
=
gtest_test_utils
.
Subprocess
(
command
)
p
=
gtest_test_utils
.
Subprocess
(
command
)
if
p
.
terminated_by_signal
:
if
p
.
terminated_by_signal
:
self
.
assert_
(
False
,
self
.
assert_
(
False
,
"
%s was killed by signal %d
"
%
(
gtest_prog_name
,
p
.
signal
))
'
%s was killed by signal %d
'
%
(
gtest_prog_name
,
p
.
signal
))
else
:
else
:
self
.
assert_
(
p
.
exited
)
self
.
assert_
(
p
.
exited
)
self
.
assertEquals
(
1
,
p
.
exit_code
,
self
.
assertEquals
(
1
,
p
.
exit_code
,
"'%s' exited with code %s, which doesn't match "
"'%s' exited with code %s, which doesn't match "
"
the expected exit code %s.
"
'
the expected exit code %s.
'
%
(
command
,
p
.
exit_code
,
1
))
%
(
command
,
p
.
exit_code
,
1
))
self
.
assert_
(
not
os
.
path
.
isfile
(
xml_path
))
self
.
assert_
(
not
os
.
path
.
isfile
(
xml_path
))
...
@@ -212,19 +218,19 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
...
@@ -212,19 +218,19 @@ class GTestXMLOutputUnitTest(gtest_xml_test_utils.GTestXMLTestCase):
expected_exit_code.
expected_exit_code.
"""
"""
xml_path
=
os
.
path
.
join
(
gtest_test_utils
.
GetTempDir
(),
xml_path
=
os
.
path
.
join
(
gtest_test_utils
.
GetTempDir
(),
gtest_prog_name
+
"
out.xml
"
)
gtest_prog_name
+
'
out.xml
'
)
gtest_prog_path
=
gtest_test_utils
.
GetTestExecutablePath
(
gtest_prog_name
)
gtest_prog_path
=
gtest_test_utils
.
GetTestExecutablePath
(
gtest_prog_name
)
command
=
[
gtest_prog_path
,
"
%s=xml:%s
"
%
(
GTEST_OUTPUT_FLAG
,
xml_path
)]
command
=
[
gtest_prog_path
,
'
%s=xml:%s
'
%
(
GTEST_OUTPUT_FLAG
,
xml_path
)]
p
=
gtest_test_utils
.
Subprocess
(
command
)
p
=
gtest_test_utils
.
Subprocess
(
command
)
if
p
.
terminated_by_signal
:
if
p
.
terminated_by_signal
:
self
.
assert_
(
False
,
self
.
assert_
(
False
,
"
%s was killed by signal %d
"
%
(
gtest_prog_name
,
p
.
signal
))
'
%s was killed by signal %d
'
%
(
gtest_prog_name
,
p
.
signal
))
else
:
else
:
self
.
assert_
(
p
.
exited
)
self
.
assert_
(
p
.
exited
)
self
.
assertEquals
(
expected_exit_code
,
p
.
exit_code
,
self
.
assertEquals
(
expected_exit_code
,
p
.
exit_code
,
"'%s' exited with code %s, which doesn't match "
"'%s' exited with code %s, which doesn't match "
"
the expected exit code %s.
"
'
the expected exit code %s.
'
%
(
command
,
p
.
exit_code
,
expected_exit_code
))
%
(
command
,
p
.
exit_code
,
expected_exit_code
))
expected
=
minidom
.
parseString
(
expected_xml
)
expected
=
minidom
.
parseString
(
expected_xml
)
...
...
test/gtest_xml_output_unittest_.cc
View file @
cc265df8
...
@@ -45,7 +45,6 @@ using ::testing::TestEventListeners;
...
@@ -45,7 +45,6 @@ using ::testing::TestEventListeners;
using
::
testing
::
TestWithParam
;
using
::
testing
::
TestWithParam
;
using
::
testing
::
UnitTest
;
using
::
testing
::
UnitTest
;
using
::
testing
::
Test
;
using
::
testing
::
Test
;
using
::
testing
::
Types
;
using
::
testing
::
Values
;
using
::
testing
::
Values
;
class
SuccessfulTest
:
public
Test
{
class
SuccessfulTest
:
public
Test
{
...
@@ -145,23 +144,27 @@ TEST_P(ValueParamTest, HasValueParamAttribute) {}
...
@@ -145,23 +144,27 @@ TEST_P(ValueParamTest, HasValueParamAttribute) {}
TEST_P
(
ValueParamTest
,
AnotherTestThatHasValueParamAttribute
)
{}
TEST_P
(
ValueParamTest
,
AnotherTestThatHasValueParamAttribute
)
{}
INSTANTIATE_TEST_CASE_P
(
Single
,
ValueParamTest
,
Values
(
33
,
42
));
INSTANTIATE_TEST_CASE_P
(
Single
,
ValueParamTest
,
Values
(
33
,
42
));
#if GTEST_HAS_TYPED_TEST
// Verifies that the type parameter name is output in the 'type_param'
// Verifies that the type parameter name is output in the 'type_param'
// XML attribute for typed tests.
// XML attribute for typed tests.
template
<
typename
T
>
class
TypedTest
:
public
Test
{};
template
<
typename
T
>
class
TypedTest
:
public
Test
{};
typedef
Types
<
int
,
long
>
TypedTestTypes
;
typedef
testing
::
Types
<
int
,
long
>
TypedTestTypes
;
TYPED_TEST_CASE
(
TypedTest
,
TypedTestTypes
);
TYPED_TEST_CASE
(
TypedTest
,
TypedTestTypes
);
TYPED_TEST
(
TypedTest
,
HasTypeParamAttribute
)
{}
TYPED_TEST
(
TypedTest
,
HasTypeParamAttribute
)
{}
#endif
#if GTEST_HAS_TYPED_TEST_P
// Verifies that the type parameter name is output in the 'type_param'
// Verifies that the type parameter name is output in the 'type_param'
// XML attribute for type-parameterized tests.
// XML attribute for type-parameterized tests.
template
<
typename
T
>
class
TypeParameterizedTestCase
:
public
Test
{};
template
<
typename
T
>
class
TypeParameterizedTestCase
:
public
Test
{};
TYPED_TEST_CASE_P
(
TypeParameterizedTestCase
);
TYPED_TEST_CASE_P
(
TypeParameterizedTestCase
);
TYPED_TEST_P
(
TypeParameterizedTestCase
,
HasTypeParamAttribute
)
{}
TYPED_TEST_P
(
TypeParameterizedTestCase
,
HasTypeParamAttribute
)
{}
REGISTER_TYPED_TEST_CASE_P
(
TypeParameterizedTestCase
,
HasTypeParamAttribute
);
REGISTER_TYPED_TEST_CASE_P
(
TypeParameterizedTestCase
,
HasTypeParamAttribute
);
typedef
Types
<
int
,
long
>
TypeParameterizedTestCaseTypes
;
typedef
testing
::
Types
<
int
,
long
>
TypeParameterizedTestCaseTypes
;
INSTANTIATE_TYPED_TEST_CASE_P
(
Single
,
INSTANTIATE_TYPED_TEST_CASE_P
(
Single
,
TypeParameterizedTestCase
,
TypeParameterizedTestCase
,
TypeParameterizedTestCaseTypes
);
TypeParameterizedTestCaseTypes
);
#endif
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
InitGoogleTest
(
&
argc
,
argv
);
InitGoogleTest
(
&
argc
,
argv
);
...
...
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