Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
yangql
googletest
Commits
52a9c14c
Commit
52a9c14c
authored
Aug 07, 2017
by
misterg
Browse files
Samples changes upstreaming
parent
aa31cb67
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
15 additions
and
18 deletions
+15
-18
googletest/samples/sample10_unittest.cc
googletest/samples/sample10_unittest.cc
+1
-5
googletest/samples/sample1_unittest.cc
googletest/samples/sample1_unittest.cc
+5
-1
googletest/samples/sample2_unittest.cc
googletest/samples/sample2_unittest.cc
+1
-1
googletest/samples/sample3_unittest.cc
googletest/samples/sample3_unittest.cc
+2
-1
googletest/samples/sample4_unittest.cc
googletest/samples/sample4_unittest.cc
+1
-1
googletest/samples/sample6_unittest.cc
googletest/samples/sample6_unittest.cc
+1
-1
googletest/samples/sample7_unittest.cc
googletest/samples/sample7_unittest.cc
+1
-1
googletest/samples/sample8_unittest.cc
googletest/samples/sample8_unittest.cc
+1
-1
googletest/samples/sample9_unittest.cc
googletest/samples/sample9_unittest.cc
+2
-6
No files found.
googletest/samples/sample10_unittest.cc
View file @
52a9c14c
...
...
@@ -34,8 +34,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "gtest/gtest.h"
namespace
{
#include "third_party/gtest/include/gtest/gtest.h"
using
::
testing
::
EmptyTestEventListener
;
using
::
testing
::
InitGoogleTest
;
using
::
testing
::
Test
;
...
...
@@ -46,7 +45,6 @@ using ::testing::TestPartResult;
using
::
testing
::
UnitTest
;
namespace
{
// We will track memory used by this class.
class
Water
{
public:
...
...
@@ -106,7 +104,6 @@ TEST(ListenersTest, LeaksWater) {
Water
*
water
=
new
Water
;
EXPECT_TRUE
(
water
!=
NULL
);
}
}
// namespace
int
main
(
int
argc
,
char
**
argv
)
{
...
...
@@ -142,4 +139,3 @@ int main(int argc, char **argv) {
}
return
RUN_ALL_TESTS
();
}
}
// namespace
\ No newline at end of file
googletest/samples/sample1_unittest.cc
View file @
52a9c14c
...
...
@@ -72,6 +72,7 @@ namespace {
//
// </TechnicalDetails>
// Tests Factorial().
// Tests factorial of negative numbers.
...
...
@@ -99,7 +100,9 @@ TEST(FactorialTest, Negative) {
}
// Tests factorial of 0.
TEST
(
FactorialTest
,
Zero
)
{
EXPECT_EQ
(
1
,
Factorial
(
0
));
}
TEST
(
FactorialTest
,
Zero
)
{
EXPECT_EQ
(
1
,
Factorial
(
0
));
}
// Tests factorial of positive numbers.
TEST
(
FactorialTest
,
Positive
)
{
...
...
@@ -109,6 +112,7 @@ TEST(FactorialTest, Positive) {
EXPECT_EQ
(
40320
,
Factorial
(
8
));
}
// Tests IsPrime()
// Tests negative input.
...
...
googletest/samples/sample2_unittest.cc
View file @
52a9c14c
googletest/samples/sample3_unittest.cc
View file @
52a9c14c
...
...
@@ -65,7 +65,7 @@
#include "sample3-inl.h"
#include "gtest/gtest.h"
namespace
{
// To use a test fixture, derive a class from testing::Test.
class
QueueTestSmpl3
:
public
testing
::
Test
{
protected:
// You should make the members protected s.t. they can be
...
...
@@ -149,3 +149,4 @@ TEST_F(QueueTestSmpl3, Map) {
MapTester
(
&
q1_
);
MapTester
(
&
q2_
);
}
}
// namespace
googletest/samples/sample4_unittest.cc
View file @
52a9c14c
googletest/samples/sample6_unittest.cc
View file @
52a9c14c
googletest/samples/sample7_unittest.cc
View file @
52a9c14c
...
...
@@ -127,4 +127,4 @@ INSTANTIATE_TEST_CASE_P(OnTheFlyAndPreCalculated, PrimeTableTestSmpl7,
TEST
(
DummyTest
,
ValueParameterizedTestsAreNotSupportedOnThisPlatform
)
{}
#endif // GTEST_HAS_PARAM_TEST
}
\ No newline at end of file
}
// namespace
googletest/samples/sample8_unittest.cc
View file @
52a9c14c
...
...
@@ -171,4 +171,4 @@ INSTANTIATE_TEST_CASE_P(MeaningfulTestParameters,
TEST
(
DummyTest
,
CombineIsNotSupportedOnThisPlatform
)
{}
#endif // GTEST_HAS_COMBINE
}
\ No newline at end of file
}
// namespace
googletest/samples/sample9_unittest.cc
View file @
52a9c14c
...
...
@@ -34,8 +34,8 @@
#include <stdio.h>
#include "gtest/gtest.h"
namespace
{
#include "
third_party/gtest/include/
gtest/gtest.h"
using
::
testing
::
EmptyTestEventListener
;
using
::
testing
::
InitGoogleTest
;
using
::
testing
::
Test
;
...
...
@@ -44,9 +44,7 @@ using ::testing::TestEventListeners;
using
::
testing
::
TestInfo
;
using
::
testing
::
TestPartResult
;
using
::
testing
::
UnitTest
;
namespace
{
// Provides alternative output mode which produces minimal amount of
// information about tests.
class
TersePrinter
:
public
EmptyTestEventListener
{
...
...
@@ -102,7 +100,6 @@ TEST(CustomOutputTest, Fails) {
EXPECT_EQ
(
1
,
2
)
<<
"This test fails in order to demonstrate alternative failure messages"
;
}
}
// namespace
int
main
(
int
argc
,
char
**
argv
)
{
...
...
@@ -158,4 +155,3 @@ int main(int argc, char **argv) {
return
ret_val
;
}
}
// namespace
\ No newline at end of file
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