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
7e7e3a6f
Unverified
Commit
7e7e3a6f
authored
Aug 15, 2018
by
Gennadiy Civil
Committed by
GitHub
Aug 15, 2018
Browse files
Merge branch 'master' into patch-1
parents
b50b2f77
997d343d
Changes
204
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
620 additions
and
181 deletions
+620
-181
googletest/test/googletest-filter-unittest.py
googletest/test/googletest-filter-unittest.py
+6
-8
googletest/test/googletest-filter-unittest_.cc
googletest/test/googletest-filter-unittest_.cc
+1
-2
googletest/test/googletest-json-outfiles-test.py
googletest/test/googletest-json-outfiles-test.py
+2
-2
googletest/test/googletest-json-output-unittest.py
googletest/test/googletest-json-output-unittest.py
+8
-1
googletest/test/googletest-linked-ptr-test.cc
googletest/test/googletest-linked-ptr-test.cc
+2
-5
googletest/test/googletest-list-tests-unittest.py
googletest/test/googletest-list-tests-unittest.py
+7
-9
googletest/test/googletest-list-tests-unittest_.cc
googletest/test/googletest-list-tests-unittest_.cc
+1
-2
googletest/test/googletest-listener-test.cc
googletest/test/googletest-listener-test.cc
+3
-3
googletest/test/googletest-message-test.cc
googletest/test/googletest-message-test.cc
+1
-2
googletest/test/googletest-options-test.cc
googletest/test/googletest-options-test.cc
+3
-5
googletest/test/googletest-output-test-golden-lin.txt
googletest/test/googletest-output-test-golden-lin.txt
+321
-105
googletest/test/googletest-output-test.py
googletest/test/googletest-output-test.py
+22
-19
googletest/test/googletest-output-test_.cc
googletest/test/googletest-output-test_.cc
+1
-3
googletest/test/googletest-param-test-invalid-name1-test.py
googletest/test/googletest-param-test-invalid-name1-test.py
+63
-0
googletest/test/googletest-param-test-invalid-name1-test_.cc
googletest/test/googletest-param-test-invalid-name1-test_.cc
+50
-0
googletest/test/googletest-param-test-invalid-name2-test.py
googletest/test/googletest-param-test-invalid-name2-test.py
+62
-0
googletest/test/googletest-param-test-invalid-name2-test_.cc
googletest/test/googletest-param-test-invalid-name2-test_.cc
+55
-0
googletest/test/googletest-param-test-test.cc
googletest/test/googletest-param-test-test.cc
+3
-4
googletest/test/googletest-param-test-test.h
googletest/test/googletest-param-test-test.h
+0
-2
googletest/test/googletest-param-test2-test.cc
googletest/test/googletest-param-test2-test.cc
+9
-9
No files found.
googletest/test/gtest
_
filter
_
unittest.py
→
googletest/test/g
oogle
test
-
filter
-
unittest.py
View file @
7e7e3a6f
...
...
@@ -33,15 +33,13 @@
A user can specify which test(s) in a Google Test program to run via either
the GTEST_FILTER environment variable or the --gtest_filter flag.
This script tests such functionality by invoking
gtest
_
filter
_
unittest_ (a program written with Google Test) with different
g
oogle
test
-
filter
-
unittest_ (a program written with Google Test) with different
environments and command line flags.
Note that test sharding may also influence which tests are filtered. Therefore,
we test that here also.
"""
__author__
=
'wan@google.com (Zhanyong Wan)'
import
os
import
re
import
sets
...
...
@@ -100,8 +98,8 @@ FILTER_FLAG = 'gtest_filter'
# The command line flag for including disabled tests.
ALSO_RUN_DISABLED_TESTS_FLAG
=
'gtest_also_run_disabled_tests'
# Command to run the gtest
_
filter
_
unittest_ program.
COMMAND
=
gtest_test_utils
.
GetTestExecutablePath
(
'gtest
_
filter
_
unittest_'
)
# Command to run the g
oogle
test
-
filter
-
unittest_ program.
COMMAND
=
gtest_test_utils
.
GetTestExecutablePath
(
'g
oogle
test
-
filter
-
unittest_'
)
# Regex for determining whether parameterized tests are enabled in the binary.
PARAM_TEST_REGEX
=
re
.
compile
(
r
'/ParamTest'
)
...
...
@@ -120,7 +118,7 @@ LIST_TESTS_FLAG = '--gtest_list_tests'
SUPPORTS_DEATH_TESTS
=
'HasDeathTest'
in
gtest_test_utils
.
Subprocess
(
[
COMMAND
,
LIST_TESTS_FLAG
]).
output
# Full names of all tests in gtest
_
filter
_
unittests_.
# Full names of all tests in g
oogle
test
-
filter
-
unittests_.
PARAM_TESTS
=
[
'SeqP/ParamTest.TestX/0'
,
'SeqP/ParamTest.TestX/1'
,
...
...
@@ -292,7 +290,7 @@ class GTestFilterUnitTest(gtest_test_utils.TestCase):
args
=
None
,
check_exit_0
=
False
):
"""Checks that binary runs correct tests for the given filter and shard.
Runs all shards of gtest
_
filter
_
unittest_ with the given filter, and
Runs all shards of g
oogle
test
-
filter
-
unittest_ with the given filter, and
verifies that the right set of tests were run. The union of tests run
on each shard should be identical to tests_to_run, without duplicates.
If check_exit_0, .
...
...
@@ -330,7 +328,7 @@ class GTestFilterUnitTest(gtest_test_utils.TestCase):
def
RunAndVerifyAllowingDisabled
(
self
,
gtest_filter
,
tests_to_run
):
"""Checks that the binary runs correct set of tests for the given filter.
Runs gtest
_
filter
_
unittest_ with the given filter, and enables
Runs g
oogle
test
-
filter
-
unittest_ with the given filter, and enables
disabled tests. Verifies that the right set of tests were run.
Args:
...
...
googletest/test/gtest
_
filter
_
unittest_.cc
→
googletest/test/g
oogle
test
-
filter
-
unittest_.cc
View file @
7e7e3a6f
...
...
@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
// Unit test for Google Test test filters.
//
...
...
googletest/test/gtest
_
json
_
outfiles
_
test.py
→
googletest/test/g
oogle
test
-
json
-
outfiles
-
test.py
View file @
7e7e3a6f
...
...
@@ -136,11 +136,11 @@ class GTestJsonOutFilesTest(gtest_test_utils.TestCase):
self
.
assert_
(
p
.
exited
)
self
.
assertEquals
(
0
,
p
.
exit_code
)
#
TODO(wan@google.com)
: libtool causes the built test binary to be
#
FIXME
: libtool causes the built test binary to be
# named lt-gtest_xml_outfiles_test_ instead of
# gtest_xml_outfiles_test_. To account for this possibility, we
# allow both names in the following code. We should remove this
#
hack when Chandler Carruth's
libtool replacement tool is ready.
#
when
libtool replacement tool is ready.
output_file_name1
=
test_name
+
'.json'
output_file1
=
os
.
path
.
join
(
self
.
output_dir_
,
output_file_name1
)
output_file_name2
=
'lt-'
+
output_file_name1
...
...
googletest/test/gtest
_
json
_
output
_
unittest.py
→
googletest/test/g
oogle
test
-
json
-
output
-
unittest.py
View file @
7e7e3a6f
...
...
@@ -46,7 +46,10 @@ GTEST_OUTPUT_FLAG = '--gtest_output'
GTEST_DEFAULT_OUTPUT_FILE
=
'test_detail.json'
GTEST_PROGRAM_NAME
=
'gtest_xml_output_unittest_'
SUPPORTS_STACK_TRACES
=
False
# The flag indicating stacktraces are not supported
NO_STACKTRACE_SUPPORT_FLAG
=
'--no_stacktrace_support'
SUPPORTS_STACK_TRACES
=
NO_STACKTRACE_SUPPORT_FLAG
not
in
sys
.
argv
if
SUPPORTS_STACK_TRACES
:
STACK_TRACE_TEMPLATE
=
'
\n
Stack trace:
\n
*'
...
...
@@ -607,5 +610,9 @@ class GTestJsonOutputUnitTest(gtest_test_utils.TestCase):
if
__name__
==
'__main__'
:
if
NO_STACKTRACE_SUPPORT_FLAG
in
sys
.
argv
:
# unittest.main() can't handle unknown flags
sys
.
argv
.
remove
(
NO_STACKTRACE_SUPPORT_FLAG
)
os
.
environ
[
'GTEST_STACK_TRACE_DEPTH'
]
=
'1'
gtest_test_utils
.
Main
()
googletest/test/gtest-linked
_
ptr
_
test.cc
→
googletest/test/g
oogle
test-linked
-
ptr
-
test.cc
View file @
7e7e3a6f
...
...
@@ -26,13 +26,10 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Authors: Dan Egnor (egnor@google.com)
// Ported to Windows: Vadim Berman (vadimb@google.com)
#include "gtest/internal/gtest-linked_ptr.h"
#include <stdlib.h>
#include "gtest/internal/gtest-linked_ptr.h"
#include "gtest/gtest.h"
namespace
{
...
...
googletest/test/gtest
_
list
_
tests
_
unittest.py
→
googletest/test/g
oogle
test
-
list
-
tests
-
unittest.py
View file @
7e7e3a6f
...
...
@@ -33,12 +33,10 @@
A user can ask Google Test to list all tests by specifying the
--gtest_list_tests flag. This script tests such functionality
by invoking gtest
_
list
_
tests
_
unittest_ (a program written with
by invoking g
oogle
test
-
list
-
tests
-
unittest_ (a program written with
Google Test) the command line flags.
"""
__author__
=
'phanna@google.com (Patrick Hanna)'
import
re
import
gtest_test_utils
...
...
@@ -47,10 +45,10 @@ import gtest_test_utils
# The command line flag for enabling/disabling listing all tests.
LIST_TESTS_FLAG
=
'gtest_list_tests'
# Path to the gtest
_
list
_
tests
_
unittest_ program.
EXE_PATH
=
gtest_test_utils
.
GetTestExecutablePath
(
'gtest
_
list
_
tests
_
unittest_'
)
# Path to the g
oogle
test
-
list
-
tests
-
unittest_ program.
EXE_PATH
=
gtest_test_utils
.
GetTestExecutablePath
(
'g
oogle
test
-
list
-
tests
-
unittest_'
)
# The expected output when running gtest
_
list
_
tests
_
unittest_ with
# The expected output when running g
oogle
test
-
list
-
tests
-
unittest_ with
# --gtest_list_tests
EXPECTED_OUTPUT_NO_FILTER_RE
=
re
.
compile
(
r
"""FooDeathTest\.
Test1
...
...
@@ -94,7 +92,7 @@ MyInstantiation/ValueParamTest\.
TestB/2 # GetParam\(\) = a very\\nlo{241}\.\.\.
"""
)
# The expected output when running gtest
_
list
_
tests
_
unittest_ with
# The expected output when running g
oogle
test
-
list
-
tests
-
unittest_ with
# --gtest_list_tests and --gtest_filter=Foo*.
EXPECTED_OUTPUT_FILTER_FOO_RE
=
re
.
compile
(
r
"""FooDeathTest\.
Test1
...
...
@@ -114,7 +112,7 @@ FooTest\.
def
Run
(
args
):
"""Runs gtest
_
list
_
tests
_
unittest_ and returns the list of tests printed."""
"""Runs g
oogle
test
-
list
-
tests
-
unittest_ and returns the list of tests printed."""
return
gtest_test_utils
.
Subprocess
([
EXE_PATH
]
+
args
,
capture_stderr
=
False
).
output
...
...
@@ -127,7 +125,7 @@ class GTestListTestsUnitTest(gtest_test_utils.TestCase):
"""Tests using the --gtest_list_tests flag to list all tests."""
def
RunAndVerify
(
self
,
flag_value
,
expected_output_re
,
other_flag
):
"""Runs gtest
_
list
_
tests
_
unittest_ and verifies that it prints
"""Runs g
oogle
test
-
list
-
tests
-
unittest_ and verifies that it prints
the correct tests.
Args:
...
...
googletest/test/gtest
_
list
_
tests
_
unittest_.cc
→
googletest/test/g
oogle
test
-
list
-
tests
-
unittest_.cc
View file @
7e7e3a6f
...
...
@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: phanna@google.com (Patrick Hanna)
// Unit test for Google Test's --gtest_list_tests flag.
//
...
...
googletest/test/gtest-listener
_
test.cc
→
googletest/test/g
oogle
test-listener
-
test.cc
View file @
7e7e3a6f
...
...
@@ -25,17 +25,17 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: vladl@google.com (Vlad Losev)
//
// The Google C++ Testing and Mocking Framework (Google Test)
//
// This file verifies Google Test event listeners receive events at the
// right times.
#include "gtest/gtest.h"
#include <vector>
#include "gtest/gtest.h"
using
::
testing
::
AddGlobalTestEnvironment
;
using
::
testing
::
Environment
;
using
::
testing
::
InitGoogleTest
;
...
...
googletest/test/gtest-message
_
test.cc
→
googletest/test/g
oogle
test-message
-
test.cc
View file @
7e7e3a6f
...
...
@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: wan@google.com (Zhanyong Wan)
//
// Tests for the Message class.
...
...
googletest/test/gtest-options
_
test.cc
→
googletest/test/g
oogle
test-options
-
test.cc
View file @
7e7e3a6f
...
...
@@ -27,7 +27,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//
// Google Test UnitTestOptions tests
//
// This file tests classes and functions used internally by
...
...
@@ -99,17 +98,16 @@ TEST(OutputFileHelpersTest, GetCurrentExecutableName) {
const
std
::
string
exe_str
=
GetCurrentExecutableName
().
string
();
#if GTEST_OS_WINDOWS
const
bool
success
=
_strcmpi
(
"gtest-options
_
test"
,
exe_str
.
c_str
())
==
0
||
_strcmpi
(
"g
oogle
test-options
-
test"
,
exe_str
.
c_str
())
==
0
||
_strcmpi
(
"gtest-options-ex_test"
,
exe_str
.
c_str
())
==
0
||
_strcmpi
(
"gtest_all_test"
,
exe_str
.
c_str
())
==
0
||
_strcmpi
(
"gtest_dll_test"
,
exe_str
.
c_str
())
==
0
;
#elif GTEST_OS_FUCHSIA
const
bool
success
=
exe_str
==
"app"
;
#else
// TODO(wan@google.com): remove the hard-coded "lt-" prefix when
// Chandler Carruth's libtool replacement is ready.
// FIXME: remove the hard-coded "lt-" prefix when libtool replacement is ready
const
bool
success
=
exe_str
==
"gtest-options
_
test"
||
exe_str
==
"g
oogle
test-options
-
test"
||
exe_str
==
"gtest_all_test"
||
exe_str
==
"lt-gtest_all_test"
||
exe_str
==
"gtest_dll_test"
;
...
...
googletest/test/gtest
_
output
_
test
_
golden
_
lin.txt
→
googletest/test/g
oogle
test
-
output
-
test
-
golden
-
lin.txt
View file @
7e7e3a6f
The non-test part of the code is expected to have 2 failures.
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Value of: false
Actual: false
Expected: true
gtest_output_test_.cc:#: Failure
Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Expected equality of these values:
2
3
Stack trace: (omitted)
[0;32m[==========] [mRunning 68 tests from 30 test cases.
[0;32m[----------] [mGlobal test environment set-up.
FooEnvironment::SetUp() called.
...
...
@@ -34,21 +38,25 @@ BarEnvironment::SetUp() called.
[0;32m[ OK ] [mPassingTest.PassingTest2
[0;32m[----------] [m2 tests from NonfatalFailureTest
[0;32m[ RUN ] [mNonfatalFailureTest.EscapesStringOperands
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Expected equality of these values:
kGoldenString
Which is: "\"Line"
actual
Which is: "actual \"string\""
gtest_output_test_.cc:#: Failure
Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Expected equality of these values:
golden
Which is: "\"Line"
actual
Which is: "actual \"string\""
Stack trace: (omitted)
[0;31m[ FAILED ] [mNonfatalFailureTest.EscapesStringOperands
[0;32m[ RUN ] [mNonfatalFailureTest.DiffForLongStrings
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Expected equality of these values:
golden_str
Which is: "\"Line\0 1\"\nLine 2"
...
...
@@ -58,241 +66,323 @@ With diff:
-\"Line\0 1\"
Line 2
Stack trace: (omitted)
[0;31m[ FAILED ] [mNonfatalFailureTest.DiffForLongStrings
[0;32m[----------] [m3 tests from FatalFailureTest
[0;32m[ RUN ] [mFatalFailureTest.FatalFailureInSubroutine
(expecting a failure that x should be 1)
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Expected equality of these values:
1
x
Which is: 2
Stack trace: (omitted)
[0;31m[ FAILED ] [mFatalFailureTest.FatalFailureInSubroutine
[0;32m[ RUN ] [mFatalFailureTest.FatalFailureInNestedSubroutine
(expecting a failure that x should be 1)
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Expected equality of these values:
1
x
Which is: 2
Stack trace: (omitted)
[0;31m[ FAILED ] [mFatalFailureTest.FatalFailureInNestedSubroutine
[0;32m[ RUN ] [mFatalFailureTest.NonfatalFailureInSubroutine
(expecting a failure on false)
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Value of: false
Actual: false
Expected: true
Stack trace: (omitted)
[0;31m[ FAILED ] [mFatalFailureTest.NonfatalFailureInSubroutine
[0;32m[----------] [m1 test from LoggingTest
[0;32m[ RUN ] [mLoggingTest.InterleavingLoggingAndAssertions
(expecting 2 failures on (3) >= (a[i]))
i == 0
i == 1
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Expected: (3) >= (a[i]), actual: 3 vs 9
Stack trace: (omitted)
i == 2
i == 3
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Expected: (3) >= (a[i]), actual: 3 vs 6
Stack trace: (omitted)
[0;31m[ FAILED ] [mLoggingTest.InterleavingLoggingAndAssertions
[0;32m[----------] [m7 tests from SCOPED_TRACETest
[0;32m[ RUN ] [mSCOPED_TRACETest.AcceptedValues
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Failed
Just checking that all these values work fine.
Google Test trace:
gtest_output_test_.cc:#: (null)
gtest_output_test_.cc:#: 1337
gtest_output_test_.cc:#: std::string
gtest_output_test_.cc:#: literal string
googletest-output-test_.cc:#: (null)
googletest-output-test_.cc:#: 1337
googletest-output-test_.cc:#: std::string
googletest-output-test_.cc:#: literal string
Stack trace: (omitted)
[0;31m[ FAILED ] [mSCOPED_TRACETest.AcceptedValues
[0;32m[ RUN ] [mSCOPED_TRACETest.ObeysScopes
(expected to fail)
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Failed
This failure is expected, and shouldn't have a trace.
gtest_output_test_.cc:#: Failure
Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed
This failure is expected, and should have a trace.
Google Test trace:
gtest_output_test_.cc:#: Expected trace
gtest_output_test_.cc:#: Failure
googletest-output-test_.cc:#: Expected trace
Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed
This failure is expected, and shouldn't have a trace.
Stack trace: (omitted)
[0;31m[ FAILED ] [mSCOPED_TRACETest.ObeysScopes
[0;32m[ RUN ] [mSCOPED_TRACETest.WorksInLoop
(expected to fail)
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Expected equality of these values:
2
n
Which is: 1
Google Test trace:
gtest_output_test_.cc:#: i = 1
gtest_output_test_.cc:#: Failure
googletest-output-test_.cc:#: i = 1
Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Expected equality of these values:
1
n
Which is: 2
Google Test trace:
gtest_output_test_.cc:#: i = 2
googletest-output-test_.cc:#: i = 2
Stack trace: (omitted)
[0;31m[ FAILED ] [mSCOPED_TRACETest.WorksInLoop
[0;32m[ RUN ] [mSCOPED_TRACETest.WorksInSubroutine
(expected to fail)
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Expected equality of these values:
2
n
Which is: 1
Google Test trace:
gtest_output_test_.cc:#: n = 1
gtest_output_test_.cc:#: Failure
googletest-output-test_.cc:#: n = 1
Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Expected equality of these values:
1
n
Which is: 2
Google Test trace:
gtest_output_test_.cc:#: n = 2
googletest-output-test_.cc:#: n = 2
Stack trace: (omitted)
[0;31m[ FAILED ] [mSCOPED_TRACETest.WorksInSubroutine
[0;32m[ RUN ] [mSCOPED_TRACETest.CanBeNested
(expected to fail)
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Expected equality of these values:
1
n
Which is: 2
Google Test trace:
gtest_output_test_.cc:#: n = 2
gtest_output_test_.cc:#:
googletest-output-test_.cc:#: n = 2
googletest-output-test_.cc:#:
Stack trace: (omitted)
[0;31m[ FAILED ] [mSCOPED_TRACETest.CanBeNested
[0;32m[ RUN ] [mSCOPED_TRACETest.CanBeRepeated
(expected to fail)
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Failed
This failure is expected, and should contain trace point A.
Google Test trace:
gtest_output_test_.cc:#: A
gtest_output_test_.cc:#: Failure
googletest-output-test_.cc:#: A
Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed
This failure is expected, and should contain trace point A and B.
Google Test trace:
gtest_output_test_.cc:#: B
gtest_output_test_.cc:#: A
gtest_output_test_.cc:#: Failure
googletest-output-test_.cc:#: B
googletest-output-test_.cc:#: A
Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed
This failure is expected, and should contain trace point A, B, and C.
Google Test trace:
gtest_output_test_.cc:#: C
gtest_output_test_.cc:#: B
gtest_output_test_.cc:#: A
gtest_output_test_.cc:#: Failure
googletest-output-test_.cc:#: C
googletest-output-test_.cc:#: B
googletest-output-test_.cc:#: A
Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed
This failure is expected, and should contain trace point A, B, and D.
Google Test trace:
gtest_output_test_.cc:#: D
gtest_output_test_.cc:#: B
gtest_output_test_.cc:#: A
googletest-output-test_.cc:#: D
googletest-output-test_.cc:#: B
googletest-output-test_.cc:#: A
Stack trace: (omitted)
[0;31m[ FAILED ] [mSCOPED_TRACETest.CanBeRepeated
[0;32m[ RUN ] [mSCOPED_TRACETest.WorksConcurrently
(expecting 6 failures)
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Failed
Expected failure #1 (in thread B, only trace B alive).
Google Test trace:
gtest_output_test_.cc:#: Trace B
gtest_output_test_.cc:#: Failure
googletest-output-test_.cc:#: Trace B
Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed
Expected failure #2 (in thread A, trace A & B both alive).
Google Test trace:
gtest_output_test_.cc:#: Trace A
gtest_output_test_.cc:#: Failure
googletest-output-test_.cc:#: Trace A
Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed
Expected failure #3 (in thread B, trace A & B both alive).
Google Test trace:
gtest_output_test_.cc:#: Trace B
gtest_output_test_.cc:#: Failure
googletest-output-test_.cc:#: Trace B
Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed
Expected failure #4 (in thread B, only trace A alive).
gtest_output_test_.cc:#: Failure
Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed
Expected failure #5 (in thread A, only trace A alive).
Google Test trace:
gtest_output_test_.cc:#: Trace A
gtest_output_test_.cc:#: Failure
googletest-output-test_.cc:#: Trace A
Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed
Expected failure #6 (in thread A, no trace alive).
Stack trace: (omitted)
[0;31m[ FAILED ] [mSCOPED_TRACETest.WorksConcurrently
[0;32m[----------] [m1 test from ScopedTraceTest
[0;32m[ RUN ] [mScopedTraceTest.WithExplicitFileAndLine
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Failed
Check that the trace is attached to a particular location.
Google Test trace:
explicit_file.cc:123: expected trace message
Stack trace: (omitted)
[0;31m[ FAILED ] [mScopedTraceTest.WithExplicitFileAndLine
[0;32m[----------] [m1 test from NonFatalFailureInFixtureConstructorTest
[0;32m[ RUN ] [mNonFatalFailureInFixtureConstructorTest.FailureInConstructor
(expecting 5 failures)
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Failed
Expected failure #1, in the test fixture c'tor.
gtest_output_test_.cc:#: Failure
Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed
Expected failure #2, in SetUp().
gtest_output_test_.cc:#: Failure
Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed
Expected failure #3, in the test body.
gtest_output_test_.cc:#: Failure
Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed
Expected failure #4, in TearDown.
gtest_output_test_.cc:#: Failure
Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed
Expected failure #5, in the test fixture d'tor.
Stack trace: (omitted)
[0;31m[ FAILED ] [mNonFatalFailureInFixtureConstructorTest.FailureInConstructor
[0;32m[----------] [m1 test from FatalFailureInFixtureConstructorTest
[0;32m[ RUN ] [mFatalFailureInFixtureConstructorTest.FailureInConstructor
(expecting 2 failures)
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Failed
Expected failure #1, in the test fixture c'tor.
gtest_output_test_.cc:#: Failure
Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed
Expected failure #2, in the test fixture d'tor.
Stack trace: (omitted)
[0;31m[ FAILED ] [mFatalFailureInFixtureConstructorTest.FailureInConstructor
[0;32m[----------] [m1 test from NonFatalFailureInSetUpTest
[0;32m[ RUN ] [mNonFatalFailureInSetUpTest.FailureInSetUp
(expecting 4 failures)
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Failed
Expected failure #1, in SetUp().
gtest_output_test_.cc:#: Failure
Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed
Expected failure #2, in the test function.
gtest_output_test_.cc:#: Failure
Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed
Expected failure #3, in TearDown().
gtest_output_test_.cc:#: Failure
Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed
Expected failure #4, in the test fixture d'tor.
Stack trace: (omitted)
[0;31m[ FAILED ] [mNonFatalFailureInSetUpTest.FailureInSetUp
[0;32m[----------] [m1 test from FatalFailureInSetUpTest
[0;32m[ RUN ] [mFatalFailureInSetUpTest.FailureInSetUp
(expecting 3 failures)
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Failed
Expected failure #1, in SetUp().
gtest_output_test_.cc:#: Failure
Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed
Expected failure #2, in TearDown().
gtest_output_test_.cc:#: Failure
Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed
Expected failure #3, in the test fixture d'tor.
Stack trace: (omitted)
[0;31m[ FAILED ] [mFatalFailureInSetUpTest.FailureInSetUp
[0;32m[----------] [m1 test from AddFailureAtTest
[0;32m[ RUN ] [mAddFailureAtTest.MessageContainsSpecifiedFileAndLineNumber
foo.cc:42: Failure
Failed
Expected failure in foo.cc
Stack trace: (omitted)
[0;31m[ FAILED ] [mAddFailureAtTest.MessageContainsSpecifiedFileAndLineNumber
[0;32m[----------] [m4 tests from MixedUpTestCaseTest
[0;32m[ RUN ] [mMixedUpTestCaseTest.FirstTestFromNamespaceFoo
...
...
@@ -309,6 +399,8 @@ using two different test fixture classes. This can happen if
the two classes are from different namespaces or translation
units and have the same name. You should probably rename one
of the classes to put the tests into different test cases.
Stack trace: (omitted)
[0;31m[ FAILED ] [mMixedUpTestCaseTest.ThisShouldFail
[0;32m[ RUN ] [mMixedUpTestCaseTest.ThisShouldFailToo
gtest.cc:#: Failure
...
...
@@ -320,6 +412,8 @@ using two different test fixture classes. This can happen if
the two classes are from different namespaces or translation
units and have the same name. You should probably rename one
of the classes to put the tests into different test cases.
Stack trace: (omitted)
[0;31m[ FAILED ] [mMixedUpTestCaseTest.ThisShouldFailToo
[0;32m[----------] [m2 tests from MixedUpTestCaseWithSameTestNameTest
[0;32m[ RUN ] [mMixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
...
...
@@ -334,6 +428,8 @@ using two different test fixture classes. This can happen if
the two classes are from different namespaces or translation
units and have the same name. You should probably rename one
of the classes to put the tests into different test cases.
Stack trace: (omitted)
[0;31m[ FAILED ] [mMixedUpTestCaseWithSameTestNameTest.TheSecondTestWithThisNameShouldFail
[0;32m[----------] [m2 tests from TEST_F_before_TEST_in_same_test_case
[0;32m[ RUN ] [mTEST_F_before_TEST_in_same_test_case.DefinedUsingTEST_F
...
...
@@ -348,6 +444,8 @@ test DefinedUsingTEST_F is defined using TEST_F but
test DefinedUsingTESTAndShouldFail is defined using TEST. You probably
want to change the TEST to TEST_F or move it to another test
case.
Stack trace: (omitted)
[0;31m[ FAILED ] [mTEST_F_before_TEST_in_same_test_case.DefinedUsingTESTAndShouldFail
[0;32m[----------] [m2 tests from TEST_before_TEST_F_in_same_test_case
[0;32m[ RUN ] [mTEST_before_TEST_F_in_same_test_case.DefinedUsingTEST
...
...
@@ -362,6 +460,8 @@ test DefinedUsingTEST_FAndShouldFail is defined using TEST_F but
test DefinedUsingTEST is defined using TEST. You probably
want to change the TEST to TEST_F or move it to another test
case.
Stack trace: (omitted)
[0;31m[ FAILED ] [mTEST_before_TEST_F_in_same_test_case.DefinedUsingTEST_FAndShouldFail
[0;32m[----------] [m8 tests from ExpectNonfatalFailureTest
[0;32m[ RUN ] [mExpectNonfatalFailureTest.CanReferenceGlobalVariables
...
...
@@ -375,19 +475,27 @@ case.
gtest.cc:#: Failure
Expected: 1 non-fatal failure
Actual: 0 failures
Stack trace: (omitted)
[0;31m[ FAILED ] [mExpectNonfatalFailureTest.FailsWhenThereIsNoNonfatalFailure
[0;32m[ RUN ] [mExpectNonfatalFailureTest.FailsWhenThereAreTwoNonfatalFailures
(expecting a failure)
gtest.cc:#: Failure
Expected: 1 non-fatal failure
Actual: 2 failures
gtest
_
output
_
test_.cc:#: Non-fatal failure:
g
oogle
test
-
output
-
test_.cc:#: Non-fatal failure:
Failed
Expected non-fatal failure 1.
Stack trace: (omitted)
gtest_output_test_.cc:#: Non-fatal failure:
googletest-output-test_.cc:#: Non-fatal failure:
Failed
Expected non-fatal failure 2.
Stack trace: (omitted)
Stack trace: (omitted)
[0;31m[ FAILED ] [mExpectNonfatalFailureTest.FailsWhenThereAreTwoNonfatalFailures
[0;32m[ RUN ] [mExpectNonfatalFailureTest.FailsWhenThereIsOneFatalFailure
...
...
@@ -395,9 +503,13 @@ Expected non-fatal failure 2.
gtest.cc:#: Failure
Expected: 1 non-fatal failure
Actual:
gtest
_
output
_
test_.cc:#: Fatal failure:
g
oogle
test
-
output
-
test_.cc:#: Fatal failure:
Failed
Expected fatal failure.
Stack trace: (omitted)
Stack trace: (omitted)
[0;31m[ FAILED ] [mExpectNonfatalFailureTest.FailsWhenThereIsOneFatalFailure
[0;32m[ RUN ] [mExpectNonfatalFailureTest.FailsWhenStatementReturns
...
...
@@ -405,12 +517,16 @@ Expected fatal failure.
gtest.cc:#: Failure
Expected: 1 non-fatal failure
Actual: 0 failures
Stack trace: (omitted)
[0;31m[ FAILED ] [mExpectNonfatalFailureTest.FailsWhenStatementReturns
[0;32m[ RUN ] [mExpectNonfatalFailureTest.FailsWhenStatementThrows
(expecting a failure)
gtest.cc:#: Failure
Expected: 1 non-fatal failure
Actual: 0 failures
Stack trace: (omitted)
[0;31m[ FAILED ] [mExpectNonfatalFailureTest.FailsWhenStatementThrows
[0;32m[----------] [m8 tests from ExpectFatalFailureTest
[0;32m[ RUN ] [mExpectFatalFailureTest.CanReferenceGlobalVariables
...
...
@@ -424,19 +540,27 @@ Expected: 1 non-fatal failure
gtest.cc:#: Failure
Expected: 1 fatal failure
Actual: 0 failures
Stack trace: (omitted)
[0;31m[ FAILED ] [mExpectFatalFailureTest.FailsWhenThereIsNoFatalFailure
[0;32m[ RUN ] [mExpectFatalFailureTest.FailsWhenThereAreTwoFatalFailures
(expecting a failure)
gtest.cc:#: Failure
Expected: 1 fatal failure
Actual: 2 failures
gtest
_
output
_
test_.cc:#: Fatal failure:
g
oogle
test
-
output
-
test_.cc:#: Fatal failure:
Failed
Expected fatal failure.
Stack trace: (omitted)
gtest
_
output
_
test_.cc:#: Fatal failure:
g
oogle
test
-
output
-
test_.cc:#: Fatal failure:
Failed
Expected fatal failure.
Stack trace: (omitted)
Stack trace: (omitted)
[0;31m[ FAILED ] [mExpectFatalFailureTest.FailsWhenThereAreTwoFatalFailures
[0;32m[ RUN ] [mExpectFatalFailureTest.FailsWhenThereIsOneNonfatalFailure
...
...
@@ -444,9 +568,13 @@ Expected fatal failure.
gtest.cc:#: Failure
Expected: 1 fatal failure
Actual:
gtest
_
output
_
test_.cc:#: Non-fatal failure:
g
oogle
test
-
output
-
test_.cc:#: Non-fatal failure:
Failed
Expected non-fatal failure.
Stack trace: (omitted)
Stack trace: (omitted)
[0;31m[ FAILED ] [mExpectFatalFailureTest.FailsWhenThereIsOneNonfatalFailure
[0;32m[ RUN ] [mExpectFatalFailureTest.FailsWhenStatementReturns
...
...
@@ -454,72 +582,94 @@ Expected non-fatal failure.
gtest.cc:#: Failure
Expected: 1 fatal failure
Actual: 0 failures
Stack trace: (omitted)
[0;31m[ FAILED ] [mExpectFatalFailureTest.FailsWhenStatementReturns
[0;32m[ RUN ] [mExpectFatalFailureTest.FailsWhenStatementThrows
(expecting a failure)
gtest.cc:#: Failure
Expected: 1 fatal failure
Actual: 0 failures
Stack trace: (omitted)
[0;31m[ FAILED ] [mExpectFatalFailureTest.FailsWhenStatementThrows
[0;32m[----------] [m2 tests from TypedTest/0, where TypeParam = int
[0;32m[ RUN ] [mTypedTest/0.Success
[0;32m[ OK ] [mTypedTest/0.Success
[0;32m[ RUN ] [mTypedTest/0.Failure
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Expected equality of these values:
1
TypeParam()
Which is: 0
Expected failure
Stack trace: (omitted)
[0;31m[ FAILED ] [mTypedTest/0.Failure, where TypeParam = int
[0;32m[----------] [m2 tests from Unsigned/TypedTestP/0, where TypeParam = unsigned char
[0;32m[ RUN ] [mUnsigned/TypedTestP/0.Success
[0;32m[ OK ] [mUnsigned/TypedTestP/0.Success
[0;32m[ RUN ] [mUnsigned/TypedTestP/0.Failure
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Expected equality of these values:
1U
Which is: 1
TypeParam()
Which is: '\0'
Expected failure
Stack trace: (omitted)
[0;31m[ FAILED ] [mUnsigned/TypedTestP/0.Failure, where TypeParam = unsigned char
[0;32m[----------] [m2 tests from Unsigned/TypedTestP/1, where TypeParam = unsigned
[0;32m[----------] [m2 tests from Unsigned/TypedTestP/1, where TypeParam = unsigned
int
[0;32m[ RUN ] [mUnsigned/TypedTestP/1.Success
[0;32m[ OK ] [mUnsigned/TypedTestP/1.Success
[0;32m[ RUN ] [mUnsigned/TypedTestP/1.Failure
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Expected equality of these values:
1U
Which is: 1
TypeParam()
Which is: 0
Expected failure
[0;31m[ FAILED ] [mUnsigned/TypedTestP/1.Failure, where TypeParam = unsigned
Stack trace: (omitted)
[0;31m[ FAILED ] [mUnsigned/TypedTestP/1.Failure, where TypeParam = unsigned int
[0;32m[----------] [m4 tests from ExpectFailureTest
[0;32m[ RUN ] [mExpectFailureTest.ExpectFatalFailure
(expecting 1 failure)
gtest.cc:#: Failure
Expected: 1 fatal failure
Actual:
gtest
_
output
_
test_.cc:#: Success:
g
oogle
test
-
output
-
test_.cc:#: Success:
Succeeded
Stack trace: (omitted)
Stack trace: (omitted)
(expecting 1 failure)
gtest.cc:#: Failure
Expected: 1 fatal failure
Actual:
gtest
_
output
_
test_.cc:#: Non-fatal failure:
g
oogle
test
-
output
-
test_.cc:#: Non-fatal failure:
Failed
Expected non-fatal failure.
Stack trace: (omitted)
Stack trace: (omitted)
(expecting 1 failure)
gtest.cc:#: Failure
Expected: 1 fatal failure containing "Some other fatal failure expected."
Actual:
gtest
_
output
_
test_.cc:#: Fatal failure:
g
oogle
test
-
output
-
test_.cc:#: Fatal failure:
Failed
Expected fatal failure.
Stack trace: (omitted)
Stack trace: (omitted)
[0;31m[ FAILED ] [mExpectFailureTest.ExpectFatalFailure
[0;32m[ RUN ] [mExpectFailureTest.ExpectNonFatalFailure
...
...
@@ -527,24 +677,36 @@ Expected fatal failure.
gtest.cc:#: Failure
Expected: 1 non-fatal failure
Actual:
gtest
_
output
_
test_.cc:#: Success:
g
oogle
test
-
output
-
test_.cc:#: Success:
Succeeded
Stack trace: (omitted)
Stack trace: (omitted)
(expecting 1 failure)
gtest.cc:#: Failure
Expected: 1 non-fatal failure
Actual:
gtest
_
output
_
test_.cc:#: Fatal failure:
g
oogle
test
-
output
-
test_.cc:#: Fatal failure:
Failed
Expected fatal failure.
Stack trace: (omitted)
Stack trace: (omitted)
(expecting 1 failure)
gtest.cc:#: Failure
Expected: 1 non-fatal failure containing "Some other non-fatal failure."
Actual:
gtest
_
output
_
test_.cc:#: Non-fatal failure:
g
oogle
test
-
output
-
test_.cc:#: Non-fatal failure:
Failed
Expected non-fatal failure.
Stack trace: (omitted)
Stack trace: (omitted)
[0;31m[ FAILED ] [mExpectFailureTest.ExpectNonFatalFailure
[0;32m[ RUN ] [mExpectFailureTest.ExpectFatalFailureOnAllThreads
...
...
@@ -552,24 +714,36 @@ Expected non-fatal failure.
gtest.cc:#: Failure
Expected: 1 fatal failure
Actual:
gtest
_
output
_
test_.cc:#: Success:
g
oogle
test
-
output
-
test_.cc:#: Success:
Succeeded
Stack trace: (omitted)
Stack trace: (omitted)
(expecting 1 failure)
gtest.cc:#: Failure
Expected: 1 fatal failure
Actual:
gtest
_
output
_
test_.cc:#: Non-fatal failure:
g
oogle
test
-
output
-
test_.cc:#: Non-fatal failure:
Failed
Expected non-fatal failure.
Stack trace: (omitted)
Stack trace: (omitted)
(expecting 1 failure)
gtest.cc:#: Failure
Expected: 1 fatal failure containing "Some other fatal failure expected."
Actual:
gtest
_
output
_
test_.cc:#: Fatal failure:
g
oogle
test
-
output
-
test_.cc:#: Fatal failure:
Failed
Expected fatal failure.
Stack trace: (omitted)
Stack trace: (omitted)
[0;31m[ FAILED ] [mExpectFailureTest.ExpectFatalFailureOnAllThreads
[0;32m[ RUN ] [mExpectFailureTest.ExpectNonFatalFailureOnAllThreads
...
...
@@ -577,83 +751,115 @@ Expected fatal failure.
gtest.cc:#: Failure
Expected: 1 non-fatal failure
Actual:
gtest
_
output
_
test_.cc:#: Success:
g
oogle
test
-
output
-
test_.cc:#: Success:
Succeeded
Stack trace: (omitted)
Stack trace: (omitted)
(expecting 1 failure)
gtest.cc:#: Failure
Expected: 1 non-fatal failure
Actual:
gtest
_
output
_
test_.cc:#: Fatal failure:
g
oogle
test
-
output
-
test_.cc:#: Fatal failure:
Failed
Expected fatal failure.
Stack trace: (omitted)
Stack trace: (omitted)
(expecting 1 failure)
gtest.cc:#: Failure
Expected: 1 non-fatal failure containing "Some other non-fatal failure."
Actual:
gtest
_
output
_
test_.cc:#: Non-fatal failure:
g
oogle
test
-
output
-
test_.cc:#: Non-fatal failure:
Failed
Expected non-fatal failure.
Stack trace: (omitted)
Stack trace: (omitted)
[0;31m[ FAILED ] [mExpectFailureTest.ExpectNonFatalFailureOnAllThreads
[0;32m[----------] [m2 tests from ExpectFailureWithThreadsTest
[0;32m[ RUN ] [mExpectFailureWithThreadsTest.ExpectFatalFailure
(expecting 2 failures)
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Failed
Expected fatal failure.
Stack trace: (omitted)
gtest.cc:#: Failure
Expected: 1 fatal failure
Actual: 0 failures
Stack trace: (omitted)
[0;31m[ FAILED ] [mExpectFailureWithThreadsTest.ExpectFatalFailure
[0;32m[ RUN ] [mExpectFailureWithThreadsTest.ExpectNonFatalFailure
(expecting 2 failures)
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Failed
Expected non-fatal failure.
Stack trace: (omitted)
gtest.cc:#: Failure
Expected: 1 non-fatal failure
Actual: 0 failures
Stack trace: (omitted)
[0;31m[ FAILED ] [mExpectFailureWithThreadsTest.ExpectNonFatalFailure
[0;32m[----------] [m1 test from ScopedFakeTestPartResultReporterTest
[0;32m[ RUN ] [mScopedFakeTestPartResultReporterTest.InterceptOnlyCurrentThread
(expecting 2 failures)
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Failed
Expected fatal failure.
gtest_output_test_.cc:#: Failure
Stack trace: (omitted)
googletest-output-test_.cc:#: Failure
Failed
Expected non-fatal failure.
Stack trace: (omitted)
[0;31m[ FAILED ] [mScopedFakeTestPartResultReporterTest.InterceptOnlyCurrentThread
[0;32m[----------] [m1 test from PrintingFailingParams/FailingParamTest
[0;32m[ RUN ] [mPrintingFailingParams/FailingParamTest.Fails/0
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Expected equality of these values:
1
GetParam()
Which is: 2
Stack trace: (omitted)
[0;31m[ FAILED ] [mPrintingFailingParams/FailingParamTest.Fails/0, where GetParam() = 2
[0;32m[----------] [m2 tests from PrintingStrings/ParamTest
[0;32m[ RUN ] [mPrintingStrings/ParamTest.Success/a
[0;32m[ OK ] [mPrintingStrings/ParamTest.Success/a
[0;32m[ RUN ] [mPrintingStrings/ParamTest.Failure/a
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Expected equality of these values:
"b"
GetParam()
Which is: "a"
Expected failure
Stack trace: (omitted)
[0;31m[ FAILED ] [mPrintingStrings/ParamTest.Failure/a, where GetParam() = "a"
[0;32m[----------] [mGlobal test environment tear-down
BarEnvironment::TearDown() called.
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Failed
Expected non-fatal failure.
Stack trace: (omitted)
FooEnvironment::TearDown() called.
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Failed
Expected fatal failure.
Stack trace: (omitted)
[0;32m[==========] [m68 tests from 30 test cases ran.
[0;32m[ PASSED ] [m22 tests.
[0;31m[ FAILED ] [m46 tests, listed below:
...
...
@@ -693,7 +899,7 @@ Expected fatal failure.
[0;31m[ FAILED ] [mExpectFatalFailureTest.FailsWhenStatementThrows
[0;31m[ FAILED ] [mTypedTest/0.Failure, where TypeParam = int
[0;31m[ FAILED ] [mUnsigned/TypedTestP/0.Failure, where TypeParam = unsigned char
[0;31m[ FAILED ] [mUnsigned/TypedTestP/1.Failure, where TypeParam = unsigned
[0;31m[ FAILED ] [mUnsigned/TypedTestP/1.Failure, where TypeParam = unsigned
int
[0;31m[ FAILED ] [mExpectFailureTest.ExpectFatalFailure
[0;31m[ FAILED ] [mExpectFailureTest.ExpectNonFatalFailure
[0;31m[ FAILED ] [mExpectFailureTest.ExpectFatalFailureOnAllThreads
...
...
@@ -713,26 +919,32 @@ Expected fatal failure.
[----------] 3 tests from FatalFailureTest
[ RUN ] FatalFailureTest.FatalFailureInSubroutine
(expecting a failure that x should be 1)
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Expected equality of these values:
1
x
Which is: 2
Stack trace: (omitted)
[ FAILED ] FatalFailureTest.FatalFailureInSubroutine (? ms)
[ RUN ] FatalFailureTest.FatalFailureInNestedSubroutine
(expecting a failure that x should be 1)
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Expected equality of these values:
1
x
Which is: 2
Stack trace: (omitted)
[ FAILED ] FatalFailureTest.FatalFailureInNestedSubroutine (? ms)
[ RUN ] FatalFailureTest.NonfatalFailureInSubroutine
(expecting a failure on false)
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Value of: false
Actual: false
Expected: true
Stack trace: (omitted)
[ FAILED ] FatalFailureTest.NonfatalFailureInSubroutine (? ms)
[----------] 3 tests from FatalFailureTest (? ms total)
...
...
@@ -741,12 +953,16 @@ Expected: true
(expecting 2 failures on (3) >= (a[i]))
i == 0
i == 1
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Expected: (3) >= (a[i]), actual: 3 vs 9
Stack trace: (omitted)
i == 2
i == 3
gtest
_
output
_
test_.cc:#: Failure
g
oogle
test
-
output
-
test_.cc:#: Failure
Expected: (3) >= (a[i]), actual: 3 vs 6
Stack trace: (omitted)
[ FAILED ] LoggingTest.InterleavingLoggingAndAssertions (? ms)
[----------] 1 test from LoggingTest (? ms total)
...
...
googletest/test/gtest
_
output
_
test.py
→
googletest/test/g
oogle
test
-
output
-
test.py
View file @
7e7e3a6f
...
...
@@ -31,16 +31,13 @@
"""Tests the text output of Google C++ Testing and Mocking Framework.
SYNOPSIS
gtest_output_test.py --build_dir=BUILD/DIR --gengolden
# where BUILD/DIR contains the built gtest_output_test_ file.
gtest_output_test.py --gengolden
gtest_output_test.py
To update the golden file:
googletest_output_test.py --build_dir=BUILD/DIR --gengolden
where BUILD/DIR contains the built googletest-output-test_ file.
googletest_output_test.py --gengolden
googletest_output_test.py
"""
__author__
=
'wan@google.com (Zhanyong Wan)'
import
difflib
import
os
import
re
...
...
@@ -52,13 +49,16 @@ import gtest_test_utils
GENGOLDEN_FLAG
=
'--gengolden'
CATCH_EXCEPTIONS_ENV_VAR_NAME
=
'GTEST_CATCH_EXCEPTIONS'
# The flag indicating stacktraces are not supported
NO_STACKTRACE_SUPPORT_FLAG
=
'--no_stacktrace_support'
IS_LINUX
=
os
.
name
==
'posix'
and
os
.
uname
()[
0
]
==
'Linux'
IS_WINDOWS
=
os
.
name
==
'nt'
#
TODO(vladl@google.com)
: remove the _lin suffix.
GOLDEN_NAME
=
'gtest
_
output
_
test
_
golden
_
lin.txt'
#
FIXME
: remove the _lin suffix.
GOLDEN_NAME
=
'g
oogle
test
-
output
-
test
-
golden
-
lin.txt'
PROGRAM_PATH
=
gtest_test_utils
.
GetTestExecutablePath
(
'gtest
_
output
_
test_'
)
PROGRAM_PATH
=
gtest_test_utils
.
GetTestExecutablePath
(
'g
oogle
test
-
output
-
test_'
)
# At least one command we exercise must not have the
# 'internal_skip_environment_and_ad_hoc_tests' argument.
...
...
@@ -101,7 +101,7 @@ def RemoveLocations(test_output):
'FILE_NAME:#: '.
"""
return
re
.
sub
(
r
'.*[/\\]((gtest
_
output
_
test_|gtest).cc)(\:\d+|\(\d+\))\: '
,
return
re
.
sub
(
r
'.*[/\\]((g
oogle
test
-
output
-
test_|gtest).cc)(\:\d+|\(\d+\))\: '
,
r
'\1:#: '
,
test_output
)
...
...
@@ -192,7 +192,7 @@ def RemoveMatchingTests(test_output, pattern):
def
NormalizeOutput
(
output
):
"""Normalizes output (the output of gtest
_
output
_
test_.exe)."""
"""Normalizes output (the output of g
oogle
test
-
output
-
test_.exe)."""
output
=
ToUnixLineEnding
(
output
)
output
=
RemoveLocations
(
output
)
...
...
@@ -252,13 +252,12 @@ test_list = GetShellCommandOutput(COMMAND_LIST_TESTS)
SUPPORTS_DEATH_TESTS
=
'DeathTest'
in
test_list
SUPPORTS_TYPED_TESTS
=
'TypedTest'
in
test_list
SUPPORTS_THREADS
=
'ExpectFailureWithThreadsTest'
in
test_list
SUPPORTS_STACK_TRACES
=
IS_LINUX
SUPPORTS_STACK_TRACES
=
NO_STACKTRACE_SUPPORT_FLAG
not
in
sys
.
argv
CAN_GENERATE_GOLDEN_FILE
=
(
SUPPORTS_DEATH_TESTS
and
SUPPORTS_TYPED_TESTS
and
SUPPORTS_THREADS
and
SUPPORTS_STACK_TRACES
and
not
IS_WINDOWS
)
SUPPORTS_STACK_TRACES
)
class
GTestOutputTest
(
gtest_test_utils
.
TestCase
):
def
RemoveUnsupportedTests
(
self
,
test_output
):
...
...
@@ -314,18 +313,22 @@ class GTestOutputTest(gtest_test_utils.TestCase):
if
os
.
getenv
(
'DEBUG_GTEST_OUTPUT_TEST'
):
open
(
os
.
path
.
join
(
gtest_test_utils
.
GetSourceDir
(),
'_gtest
_
output
_
test_normalized_actual.txt'
),
'wb'
).
write
(
'_g
oogle
test
-
output
-
test_normalized_actual.txt'
),
'wb'
).
write
(
normalized_actual
)
open
(
os
.
path
.
join
(
gtest_test_utils
.
GetSourceDir
(),
'_gtest
_
output
_
test_normalized_golden.txt'
),
'wb'
).
write
(
'_g
oogle
test
-
output
-
test_normalized_golden.txt'
),
'wb'
).
write
(
normalized_golden
)
self
.
assertEqual
(
normalized_golden
,
normalized_actual
)
if
__name__
==
'__main__'
:
if
sys
.
argv
[
1
:]
==
[
GENGOLDEN_FLAG
]:
if
NO_STACKTRACE_SUPPORT_FLAG
in
sys
.
argv
:
# unittest.main() can't handle unknown flags
sys
.
argv
.
remove
(
NO_STACKTRACE_SUPPORT_FLAG
)
if
GENGOLDEN_FLAG
in
sys
.
argv
:
if
CAN_GENERATE_GOLDEN_FILE
:
output
=
GetOutputOfAllCommands
()
golden_file
=
open
(
GOLDEN_PATH
,
'wb'
)
...
...
googletest/test/gtest
_
output
_
test_.cc
→
googletest/test/g
oogle
test
-
output
-
test_.cc
View file @
7e7e3a6f
...
...
@@ -29,11 +29,9 @@
//
// The purpose of this file is to generate Google Test output under
// various conditions. The output will then be verified by
// gtest
_
output
_
test.py to ensure that Google Test generates the
// g
oogle
test
-
output
-
test.py to ensure that Google Test generates the
// desired messages. Therefore, most tests in this file are MEANT TO
// FAIL.
//
// Author: wan@google.com (Zhanyong Wan)
#include "gtest/gtest-spi.h"
#include "gtest/gtest.h"
...
...
googletest/test/googletest-param-test-invalid-name1-test.py
0 → 100644
View file @
7e7e3a6f
#!/usr/bin/env python
#
# Copyright 2015 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""Verifies that Google Test warns the user when not initialized properly."""
import
gtest_test_utils
binary_name
=
'googletest-param-test-invalid-name1-test_'
COMMAND
=
gtest_test_utils
.
GetTestExecutablePath
(
binary_name
)
def
Assert
(
condition
):
if
not
condition
:
raise
AssertionError
def
TestExitCodeAndOutput
(
command
):
"""Runs the given command and verifies its exit code and output."""
err
=
(
'Parameterized test name
\'
"InvalidWithQuotes"
\'
is invalid'
)
p
=
gtest_test_utils
.
Subprocess
(
command
)
Assert
(
p
.
terminated_by_signal
)
# Verify the output message contains appropriate output
Assert
(
err
in
p
.
output
)
class
GTestParamTestInvalidName1Test
(
gtest_test_utils
.
TestCase
):
def
testExitCodeAndOutput
(
self
):
TestExitCodeAndOutput
(
COMMAND
)
if
__name__
==
'__main__'
:
gtest_test_utils
.
Main
()
googletest/test/googletest-param-test-invalid-name1-test_.cc
0 → 100644
View file @
7e7e3a6f
// Copyright 2015, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "gtest/gtest.h"
namespace
{
class
DummyTest
:
public
::
testing
::
TestWithParam
<
const
char
*>
{};
TEST_P
(
DummyTest
,
Dummy
)
{
}
INSTANTIATE_TEST_CASE_P
(
InvalidTestName
,
DummyTest
,
::
testing
::
Values
(
"InvalidWithQuotes"
),
::
testing
::
PrintToStringParamName
());
}
// namespace
int
main
(
int
argc
,
char
*
argv
[])
{
testing
::
InitGoogleTest
(
&
argc
,
argv
);
return
RUN_ALL_TESTS
();
}
googletest/test/googletest-param-test-invalid-name2-test.py
0 → 100644
View file @
7e7e3a6f
#!/usr/bin/env python
#
# Copyright 2015 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""Verifies that Google Test warns the user when not initialized properly."""
import
gtest_test_utils
binary_name
=
'googletest-param-test-invalid-name2-test_'
COMMAND
=
gtest_test_utils
.
GetTestExecutablePath
(
binary_name
)
def
Assert
(
condition
):
if
not
condition
:
raise
AssertionError
def
TestExitCodeAndOutput
(
command
):
"""Runs the given command and verifies its exit code and output."""
err
=
(
'Duplicate parameterized test name
\'
a
\'
'
)
p
=
gtest_test_utils
.
Subprocess
(
command
)
Assert
(
p
.
terminated_by_signal
)
# Check for appropriate output
Assert
(
err
in
p
.
output
)
class
GTestParamTestInvalidName2Test
(
gtest_test_utils
.
TestCase
):
def
testExitCodeAndOutput
(
self
):
TestExitCodeAndOutput
(
COMMAND
)
if
__name__
==
'__main__'
:
gtest_test_utils
.
Main
()
googletest/test/googletest-param-test-invalid-name2-test_.cc
0 → 100644
View file @
7e7e3a6f
// Copyright 2015, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "gtest/gtest.h"
namespace
{
class
DummyTest
:
public
::
testing
::
TestWithParam
<
const
char
*>
{};
std
::
string
StringParamTestSuffix
(
const
testing
::
TestParamInfo
<
const
char
*>&
info
)
{
return
std
::
string
(
info
.
param
);
}
TEST_P
(
DummyTest
,
Dummy
)
{
}
INSTANTIATE_TEST_CASE_P
(
DuplicateTestNames
,
DummyTest
,
::
testing
::
Values
(
"a"
,
"b"
,
"a"
,
"c"
),
StringParamTestSuffix
);
}
// namespace
int
main
(
int
argc
,
char
*
argv
[])
{
testing
::
InitGoogleTest
(
&
argc
,
argv
);
return
RUN_ALL_TESTS
();
}
googletest/test/gtest-param-test
_
test.cc
→
googletest/test/g
oogle
test-param-test
-
test.cc
View file @
7e7e3a6f
...
...
@@ -26,8 +26,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: vladl@google.com (Vlad Losev)
//
// Tests for Google Test itself. This file verifies that the parameter
// generators objects produce correct parameter sequences and that
...
...
@@ -43,7 +42,7 @@
# include <vector>
# include "src/gtest-internal-inl.h" // for UnitTestOptions
# include "test/gtest-param-test
_
test.h"
# include "test/g
oogle
test-param-test
-
test.h"
using
::
std
::
vector
;
using
::
std
::
sort
;
...
...
@@ -68,7 +67,7 @@ using ::testing::internal::UnitTestOptions;
// Prints a value to a string.
//
//
TODO(wan@google.com)
: remove PrintValue() when we move matchers and
//
FIXME
: remove PrintValue() when we move matchers and
// EXPECT_THAT() from Google Mock to Google Test. At that time, we
// can write EXPECT_THAT(x, Eq(y)) to compare two tuples x and y, as
// EXPECT_THAT() and the matchers know how to print tuples.
...
...
googletest/test/gtest-param-test
_
test.h
→
googletest/test/g
oogle
test-param-test
-
test.h
View file @
7e7e3a6f
...
...
@@ -27,8 +27,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Authors: vladl@google.com (Vlad Losev)
//
// The Google C++ Testing and Mocking Framework (Google Test)
//
// This header file provides classes and functions used internally
...
...
googletest/test/gtest-param-test2
_
test.cc
→
googletest/test/g
oogle
test-param-test2
-
test.cc
View file @
7e7e3a6f
...
...
@@ -26,35 +26,35 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Author: vladl@google.com (Vlad Losev)
//
// Tests for Google Test itself. This verifies that the basic constructs of
// Google Test work.
#include "gtest/gtest.h"
#include "
g
test-param-test
_
test.h"
#include "
test/google
test-param-test
-
test.h"
using
::
testing
::
Values
;
using
::
testing
::
internal
::
ParamGenerator
;
// Tests that generators defined in a different translation unit
// are functional. The test using extern_gen is defined
// in gtest-param-test
_
test.cc.
// in g
oogle
test-param-test
-
test.cc.
ParamGenerator
<
int
>
extern_gen
=
Values
(
33
);
// Tests that a parameterized test case can be defined in one translation unit
// and instantiated in another. The test is defined in
gtest-param-test_test.cc
// and ExternalInstantiationTest fixture class is
defined in
// gtest-param-test_test.h.
// and instantiated in another. The test is defined in
//
googletest-param-test-test.cc
and ExternalInstantiationTest fixture class is
//
defined in
gtest-param-test_test.h.
INSTANTIATE_TEST_CASE_P
(
MultiplesOf33
,
ExternalInstantiationTest
,
Values
(
33
,
66
));
// Tests that a parameterized test case can be instantiated
// in multiple translation units. Another instantiation is defined
// in gtest-param-test_test.cc and InstantiationInMultipleTranslaionUnitsTest
// fixture is defined in gtest-param-test_test.h
// in googletest-param-test-test.cc and
// InstantiationInMultipleTranslaionUnitsTest fixture is defined in
// gtest-param-test_test.h
INSTANTIATE_TEST_CASE_P
(
Sequence2
,
InstantiationInMultipleTranslaionUnitsTest
,
Values
(
42
*
3
,
42
*
4
,
42
*
5
));
...
...
Prev
1
…
4
5
6
7
8
9
10
11
Next
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