From 8876622b6fcebc21672bc263666b858b7e152b45 Mon Sep 17 00:00:00 2001 From: Gil Date: Thu, 12 Apr 2018 14:54:53 -0700 Subject: Add clang-tidy checks for Firestore (#1078) * Add a .clang-tidy configuration for Firestore C++ * Fix clang-tidy warnings * typedef -> using * const ref + rvalue ref -> pass by value * NULL -> nullptr * remove useless default initializations * remove useless const value-type parameter declarations (definitions can still use them) * use auto instead of repeating types in a cast * Fix typos * Address use of static method through instance warnings * Address use after move warnings --- Firestore/core/test/firebase/firestore/util/bits_test.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'Firestore/core/test/firebase/firestore/util') diff --git a/Firestore/core/test/firebase/firestore/util/bits_test.cc b/Firestore/core/test/firebase/firestore/util/bits_test.cc index cb0976b..572721f 100644 --- a/Firestore/core/test/firebase/firestore/util/bits_test.cc +++ b/Firestore/core/test/firebase/firestore/util/bits_test.cc @@ -69,16 +69,16 @@ TEST_F(BitsTest, Log2Random) { std::cout << "TestLog2Random" << std::endl; for (int i = 0; i < kNumIterations; i++) { - int maxbit = -1; + int max_bit = -1; uint32_t n = 0; while (!random_.OneIn(32u)) { int bit = static_cast(random_.Uniform(32u)); n |= (1U << bit); - maxbit = std::max(bit, maxbit); + max_bit = std::max(bit, max_bit); } - EXPECT_EQ(maxbit, Bits::Log2Floor(n)); + EXPECT_EQ(max_bit, Bits::Log2Floor(n)); if (n != 0) { - EXPECT_EQ(maxbit, Bits::Log2FloorNonZero(n)); + EXPECT_EQ(max_bit, Bits::Log2FloorNonZero(n)); } } } @@ -87,16 +87,16 @@ TEST_F(BitsTest, Log2Random64) { std::cout << "TestLog2Random64" << std::endl; for (int i = 0; i < kNumIterations; i++) { - int maxbit = -1; + int max_bit = -1; uint64_t n = 0; while (!random_.OneIn(64u)) { int bit = static_cast(random_.Uniform(64u)); n |= (1ULL << bit); - maxbit = std::max(bit, maxbit); + max_bit = std::max(bit, max_bit); } - EXPECT_EQ(maxbit, Bits::Log2Floor64(n)); + EXPECT_EQ(max_bit, Bits::Log2Floor64(n)); if (n != 0) { - EXPECT_EQ(maxbit, Bits::Log2FloorNonZero64(n)); + EXPECT_EQ(max_bit, Bits::Log2FloorNonZero64(n)); } } } -- cgit v1.2.3