From 515f2492fbc0a023eb089e91e349106da325de5e Mon Sep 17 00:00:00 2001 From: "hans@chromium.org" Date: Fri, 14 Jan 2011 10:36:28 +0000 Subject: Clang: enable -Wbool-conversions and -Wunused-variables on Linux. -Wbool-conversion warns about EXPECT_EQ(false, blah), so replace that with EXPECT_FALSE(blah). Do the same with EXPECT_EQ(true, blah) for good measure (even though that doesn't generate warnings). Also remove the one instance of an unused variable. BUG=69421 TEST=buildbots all compile and all tests pass Review URL: http://codereview.chromium.org/6300001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71431 0039d316-1c4b-4281-b951-d872f2087c98 --- courgette/encoded_program_fuzz_unittest.cc | 2 +- courgette/streams_unittest.cc | 36 +++++++++++++-------------- courgette/third_party/paged_array_unittest.cc | 4 +-- 3 files changed, 21 insertions(+), 21 deletions(-) (limited to 'courgette') diff --git a/courgette/encoded_program_fuzz_unittest.cc b/courgette/encoded_program_fuzz_unittest.cc index 9f7e053..a869bc2 100644 --- a/courgette/encoded_program_fuzz_unittest.cc +++ b/courgette/encoded_program_fuzz_unittest.cc @@ -95,7 +95,7 @@ void DecodeFuzzTest::FuzzExe(const char* file_name) const { std::string base_buffer(reinterpret_cast(sink.Buffer()), length); std::string base_output; bool ok = TryAssemble(base_buffer, &base_output); - EXPECT_EQ(true, ok); + EXPECT_TRUE(ok); // Now we have a good serialized EncodedProgram in |base_buffer|. Time to // fuzz. diff --git a/courgette/streams_unittest.cc b/courgette/streams_unittest.cc index e82c2d7..64c12dd 100644 --- a/courgette/streams_unittest.cc +++ b/courgette/streams_unittest.cc @@ -22,7 +22,7 @@ TEST(StreamsTest, SimpleWriteRead) { unsigned int value; bool can_read = source.ReadVarint32(&value); - EXPECT_EQ(true, can_read); + EXPECT_TRUE(can_read); EXPECT_EQ(kValue1, value); EXPECT_EQ(0U, source.Remaining()); } @@ -40,7 +40,7 @@ TEST(StreamsTest, SimpleWriteRead2) { char text[10] = {0}; bool can_read = source.Read(text, 5); - EXPECT_EQ(true, can_read); + EXPECT_TRUE(can_read); EXPECT_EQ(0, memcmp("Hello", text, 5)); EXPECT_EQ(0U, source.Remaining()); } @@ -62,11 +62,11 @@ TEST(StreamsTest, StreamSetWriteRead) { courgette::SourceStreamSet in; bool can_init = in.Init(collected_buffer, collected_length); - EXPECT_EQ(true, can_init); + EXPECT_TRUE(can_init); uint32 value; bool can_read = in.stream(3)->ReadVarint32(&value); - EXPECT_EQ(true, can_read); + EXPECT_TRUE(can_read); EXPECT_EQ(kValue1, value); EXPECT_EQ(0U, in.stream(3)->Remaining()); EXPECT_EQ(0U, in.stream(2)->Remaining()); @@ -99,14 +99,14 @@ TEST(StreamsTest, StreamSetWriteRead2) { courgette::SourceStreamSet in; bool can_init = in.Init(collected.Buffer(), collected.Length()); - EXPECT_EQ(true, can_init); + EXPECT_TRUE(can_init); for (size_t i = 0; data[i] != kEnd; i += 2) { size_t id = data[i]; size_t datum = data[i + 1]; uint32 value = 77; bool can_read = in.stream(id)->ReadVarint32(&value); - EXPECT_EQ(true, can_read); + EXPECT_TRUE(can_read); EXPECT_EQ(datum, value); } @@ -143,11 +143,11 @@ TEST(StreamsTest, SignedVarint32) { int written_value = values[i]; int32 datum; bool can_read = in.ReadVarint32Signed(&datum); - EXPECT_EQ(true, can_read); + EXPECT_TRUE(can_read); EXPECT_EQ(written_value, datum); } - EXPECT_EQ(true, in.Empty()); + EXPECT_TRUE(in.Empty()); } TEST(StreamsTest, StreamSetReadWrite) { @@ -169,17 +169,17 @@ TEST(StreamsTest, StreamSetReadWrite) { out.CopyTo(&collected); courgette::SourceStreamSet in; bool can_init_in = in.Init(collected.Buffer(), collected.Length()); - EXPECT_EQ(true, can_init_in); + EXPECT_TRUE(can_init_in); courgette::SourceStreamSet subset1; bool can_read_1 = in.ReadSet(&subset1); - EXPECT_EQ(true, can_read_1); + EXPECT_TRUE(can_read_1); EXPECT_FALSE(in.Empty()); courgette::SourceStreamSet subset2; bool can_read_2 = in.ReadSet(&subset2); - EXPECT_EQ(true, can_read_2); - EXPECT_EQ(true, in.Empty()); + EXPECT_TRUE(can_read_2); + EXPECT_TRUE(in.Empty()); courgette::SourceStreamSet subset3; bool can_read_3 = in.ReadSet(&subset3); @@ -189,15 +189,15 @@ TEST(StreamsTest, StreamSetReadWrite) { EXPECT_FALSE(subset1.Empty()); uint32 datum; - EXPECT_EQ(true, subset1.stream(3)->ReadVarint32(&datum)); + EXPECT_TRUE(subset1.stream(3)->ReadVarint32(&datum)); EXPECT_EQ(30000U, datum); - EXPECT_EQ(true, subset1.stream(5)->ReadVarint32(&datum)); + EXPECT_TRUE(subset1.stream(5)->ReadVarint32(&datum)); EXPECT_EQ(50000U, datum); - EXPECT_EQ(true, subset1.Empty()); + EXPECT_TRUE(subset1.Empty()); - EXPECT_EQ(true, subset2.stream(2)->ReadVarint32(&datum)); + EXPECT_TRUE(subset2.stream(2)->ReadVarint32(&datum)); EXPECT_EQ(20000U, datum); - EXPECT_EQ(true, subset2.stream(6)->ReadVarint32(&datum)); + EXPECT_TRUE(subset2.stream(6)->ReadVarint32(&datum)); EXPECT_EQ(60000U, datum); - EXPECT_EQ(true, subset2.Empty()); + EXPECT_TRUE(subset2.Empty()); } diff --git a/courgette/third_party/paged_array_unittest.cc b/courgette/third_party/paged_array_unittest.cc index 9736ca0..f65d686 100644 --- a/courgette/third_party/paged_array_unittest.cc +++ b/courgette/third_party/paged_array_unittest.cc @@ -17,14 +17,14 @@ class PagedArrayTest : public testing::Test { TEST_F(PagedArrayTest, TestManyAllocationsDestructorFree) { for (int i = 0; i < kIterations; ++i) { courgette::PagedArray a; - EXPECT_EQ(true, a.Allocate(kSize)); + EXPECT_TRUE(a.Allocate(kSize)); } } TEST_F(PagedArrayTest, TestManyAllocationsManualFree) { courgette::PagedArray a; for (int i = 0; i < kIterations; ++i) { - EXPECT_EQ(true, a.Allocate(kSize)); + EXPECT_TRUE(a.Allocate(kSize)); a.clear(); } } -- cgit v1.1