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
52a9c14c
Commit
52a9c14c
authored
Aug 07, 2017
by
misterg
Browse files
Samples changes upstreaming
parent
aa31cb67
Changes
9
Hide 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 @@
...
@@ -34,8 +34,7 @@
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include "gtest/gtest.h"
#include "third_party/gtest/include/gtest/gtest.h"
namespace
{
using
::
testing
::
EmptyTestEventListener
;
using
::
testing
::
EmptyTestEventListener
;
using
::
testing
::
InitGoogleTest
;
using
::
testing
::
InitGoogleTest
;
using
::
testing
::
Test
;
using
::
testing
::
Test
;
...
@@ -46,7 +45,6 @@ using ::testing::TestPartResult;
...
@@ -46,7 +45,6 @@ using ::testing::TestPartResult;
using
::
testing
::
UnitTest
;
using
::
testing
::
UnitTest
;
namespace
{
namespace
{
// We will track memory used by this class.
// We will track memory used by this class.
class
Water
{
class
Water
{
public:
public:
...
@@ -106,7 +104,6 @@ TEST(ListenersTest, LeaksWater) {
...
@@ -106,7 +104,6 @@ TEST(ListenersTest, LeaksWater) {
Water
*
water
=
new
Water
;
Water
*
water
=
new
Water
;
EXPECT_TRUE
(
water
!=
NULL
);
EXPECT_TRUE
(
water
!=
NULL
);
}
}
}
// namespace
}
// namespace
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
...
@@ -142,4 +139,3 @@ int main(int argc, char **argv) {
...
@@ -142,4 +139,3 @@ int main(int argc, char **argv) {
}
}
return
RUN_ALL_TESTS
();
return
RUN_ALL_TESTS
();
}
}
}
// namespace
\ No newline at end of file
googletest/samples/sample1_unittest.cc
View file @
52a9c14c
...
@@ -72,6 +72,7 @@ namespace {
...
@@ -72,6 +72,7 @@ namespace {
//
//
// </TechnicalDetails>
// </TechnicalDetails>
// Tests Factorial().
// Tests Factorial().
// Tests factorial of negative numbers.
// Tests factorial of negative numbers.
...
@@ -99,7 +100,9 @@ TEST(FactorialTest, Negative) {
...
@@ -99,7 +100,9 @@ TEST(FactorialTest, Negative) {
}
}
// Tests factorial of 0.
// 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.
// Tests factorial of positive numbers.
TEST
(
FactorialTest
,
Positive
)
{
TEST
(
FactorialTest
,
Positive
)
{
...
@@ -109,6 +112,7 @@ TEST(FactorialTest, Positive) {
...
@@ -109,6 +112,7 @@ TEST(FactorialTest, Positive) {
EXPECT_EQ
(
40320
,
Factorial
(
8
));
EXPECT_EQ
(
40320
,
Factorial
(
8
));
}
}
// Tests IsPrime()
// Tests IsPrime()
// Tests negative input.
// Tests negative input.
...
...
googletest/samples/sample2_unittest.cc
View file @
52a9c14c
...
@@ -107,4 +107,4 @@ TEST(MyString, Set) {
...
@@ -107,4 +107,4 @@ TEST(MyString, Set) {
s
.
Set
(
NULL
);
s
.
Set
(
NULL
);
EXPECT_STREQ
(
NULL
,
s
.
c_string
());
EXPECT_STREQ
(
NULL
,
s
.
c_string
());
}
}
}
// namespace
}
// namespace
\ No newline at end of file
googletest/samples/sample3_unittest.cc
View file @
52a9c14c
...
@@ -65,7 +65,7 @@
...
@@ -65,7 +65,7 @@
#include "sample3-inl.h"
#include "sample3-inl.h"
#include "gtest/gtest.h"
#include "gtest/gtest.h"
namespace
{
// To use a test fixture, derive a class from testing::Test.
// To use a test fixture, derive a class from testing::Test.
class
QueueTestSmpl3
:
public
testing
::
Test
{
class
QueueTestSmpl3
:
public
testing
::
Test
{
protected:
// You should make the members protected s.t. they can be
protected:
// You should make the members protected s.t. they can be
...
@@ -149,3 +149,4 @@ TEST_F(QueueTestSmpl3, Map) {
...
@@ -149,3 +149,4 @@ TEST_F(QueueTestSmpl3, Map) {
MapTester
(
&
q1_
);
MapTester
(
&
q1_
);
MapTester
(
&
q2_
);
MapTester
(
&
q2_
);
}
}
}
// namespace
googletest/samples/sample4_unittest.cc
View file @
52a9c14c
...
@@ -43,4 +43,4 @@ TEST(Counter, Increment) {
...
@@ -43,4 +43,4 @@ TEST(Counter, Increment) {
EXPECT_EQ
(
1
,
c
.
Increment
());
EXPECT_EQ
(
1
,
c
.
Increment
());
EXPECT_EQ
(
2
,
c
.
Increment
());
EXPECT_EQ
(
2
,
c
.
Increment
());
}
}
}
// namespace
}
// namespace
\ No newline at end of file
googletest/samples/sample6_unittest.cc
View file @
52a9c14c
...
@@ -222,4 +222,4 @@ INSTANTIATE_TYPED_TEST_CASE_P(OnTheFlyAndPreCalculated, // Instance name
...
@@ -222,4 +222,4 @@ INSTANTIATE_TYPED_TEST_CASE_P(OnTheFlyAndPreCalculated, // Instance name
PrimeTableImplementations
);
// Type list
PrimeTableImplementations
);
// Type list
#endif // GTEST_HAS_TYPED_TEST_P
#endif // GTEST_HAS_TYPED_TEST_P
}
// namespace
}
// namespace
\ No newline at end of file
googletest/samples/sample7_unittest.cc
View file @
52a9c14c
...
@@ -127,4 +127,4 @@ INSTANTIATE_TEST_CASE_P(OnTheFlyAndPreCalculated, PrimeTableTestSmpl7,
...
@@ -127,4 +127,4 @@ INSTANTIATE_TEST_CASE_P(OnTheFlyAndPreCalculated, PrimeTableTestSmpl7,
TEST
(
DummyTest
,
ValueParameterizedTestsAreNotSupportedOnThisPlatform
)
{}
TEST
(
DummyTest
,
ValueParameterizedTestsAreNotSupportedOnThisPlatform
)
{}
#endif // GTEST_HAS_PARAM_TEST
#endif // GTEST_HAS_PARAM_TEST
}
}
// namespace
\ No newline at end of file
googletest/samples/sample8_unittest.cc
View file @
52a9c14c
...
@@ -171,4 +171,4 @@ INSTANTIATE_TEST_CASE_P(MeaningfulTestParameters,
...
@@ -171,4 +171,4 @@ INSTANTIATE_TEST_CASE_P(MeaningfulTestParameters,
TEST
(
DummyTest
,
CombineIsNotSupportedOnThisPlatform
)
{}
TEST
(
DummyTest
,
CombineIsNotSupportedOnThisPlatform
)
{}
#endif // GTEST_HAS_COMBINE
#endif // GTEST_HAS_COMBINE
}
}
// namespace
\ No newline at end of file
googletest/samples/sample9_unittest.cc
View file @
52a9c14c
...
@@ -34,8 +34,8 @@
...
@@ -34,8 +34,8 @@
#include <stdio.h>
#include <stdio.h>
#include "gtest/gtest.h"
#include "
third_party/gtest/include/
gtest/gtest.h"
namespace
{
using
::
testing
::
EmptyTestEventListener
;
using
::
testing
::
EmptyTestEventListener
;
using
::
testing
::
InitGoogleTest
;
using
::
testing
::
InitGoogleTest
;
using
::
testing
::
Test
;
using
::
testing
::
Test
;
...
@@ -44,9 +44,7 @@ using ::testing::TestEventListeners;
...
@@ -44,9 +44,7 @@ using ::testing::TestEventListeners;
using
::
testing
::
TestInfo
;
using
::
testing
::
TestInfo
;
using
::
testing
::
TestPartResult
;
using
::
testing
::
TestPartResult
;
using
::
testing
::
UnitTest
;
using
::
testing
::
UnitTest
;
namespace
{
namespace
{
// Provides alternative output mode which produces minimal amount of
// Provides alternative output mode which produces minimal amount of
// information about tests.
// information about tests.
class
TersePrinter
:
public
EmptyTestEventListener
{
class
TersePrinter
:
public
EmptyTestEventListener
{
...
@@ -102,7 +100,6 @@ TEST(CustomOutputTest, Fails) {
...
@@ -102,7 +100,6 @@ TEST(CustomOutputTest, Fails) {
EXPECT_EQ
(
1
,
2
)
EXPECT_EQ
(
1
,
2
)
<<
"This test fails in order to demonstrate alternative failure messages"
;
<<
"This test fails in order to demonstrate alternative failure messages"
;
}
}
}
// namespace
}
// namespace
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
...
@@ -158,4 +155,3 @@ int main(int argc, char **argv) {
...
@@ -158,4 +155,3 @@ int main(int argc, char **argv) {
return
ret_val
;
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