summaryrefslogtreecommitdiffstats
path: root/googletest/samples/sample5_unittest.cc
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2018-10-04 22:28:05 (GMT)
committerGennadiy Civil <misterg@google.com>2018-10-05 16:54:14 (GMT)
commit4bb49ed640e34e23187ad7ea689693ef9927033f (patch)
tree31bfca77d3e46134fddebe28118bcba3af711e45 /googletest/samples/sample5_unittest.cc
parentf13bbe2992d188e834339abe6f715b2b2f840a77 (diff)
downloadgoogletest-4bb49ed640e34e23187ad7ea689693ef9927033f.zip
googletest-4bb49ed640e34e23187ad7ea689693ef9927033f.tar.gz
googletest-4bb49ed640e34e23187ad7ea689693ef9927033f.tar.bz2
Apply clang-tidy modernize-use-nullptr to googletest.
Now that googletest has moved to C++11, it should no longer use NULL or 0 for the null pointer. This patch converts all such usages to nullptr using clang-tidy. This prevents LLVM from issuing -Wzero-as-null-pointer-constant warnings. PiperOrigin-RevId: 215814400
Diffstat (limited to 'googletest/samples/sample5_unittest.cc')
-rw-r--r--googletest/samples/sample5_unittest.cc12
1 files changed, 5 insertions, 7 deletions
diff --git a/googletest/samples/sample5_unittest.cc b/googletest/samples/sample5_unittest.cc
index d8a8788..e71b903 100644
--- a/googletest/samples/sample5_unittest.cc
+++ b/googletest/samples/sample5_unittest.cc
@@ -63,15 +63,13 @@ class QuickTest : public testing::Test {
protected:
// Remember that SetUp() is run immediately before a test starts.
// This is a good place to record the start time.
- virtual void SetUp() {
- start_time_ = time(NULL);
- }
+ virtual void SetUp() { start_time_ = time(nullptr); }
// TearDown() is invoked immediately after a test finishes. Here we
// check if the test was too slow.
virtual void TearDown() {
// Gets the time when the test finishes
- const time_t end_time = time(NULL);
+ const time_t end_time = time(nullptr);
// Asserts that the test took no more than ~5 seconds. Did you
// know that you can use assertions in SetUp() and TearDown() as
@@ -176,16 +174,16 @@ TEST_F(QueueTest, DefaultConstructor) {
// Tests Dequeue().
TEST_F(QueueTest, Dequeue) {
int* n = q0_.Dequeue();
- EXPECT_TRUE(n == NULL);
+ EXPECT_TRUE(n == nullptr);
n = q1_.Dequeue();
- EXPECT_TRUE(n != NULL);
+ EXPECT_TRUE(n != nullptr);
EXPECT_EQ(1, *n);
EXPECT_EQ(0u, q1_.Size());
delete n;
n = q2_.Dequeue();
- EXPECT_TRUE(n != NULL);
+ EXPECT_TRUE(n != nullptr);
EXPECT_EQ(2, *n);
EXPECT_EQ(1u, q2_.Size());
delete n;