diff options
author | Googler <noreply@google.com> | 2018-06-22 07:10:41 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-06-22 07:11:56 -0700 |
commit | 8765ddfd40188a52ac4b034d54663a6d7346cc61 (patch) | |
tree | 762a82b8fe150a1d2bf1b9bafb90dbdbafef5e3a /src/test/cpp | |
parent | 3af3846438e7cbdb7540bf551c3bcce3b3f2db52 (diff) |
Automatic ClangTidyReadability code cleanup.
PiperOrigin-RevId: 201680493
Diffstat (limited to 'src/test/cpp')
-rw-r--r-- | src/test/cpp/util/file_test.cc | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/test/cpp/util/file_test.cc b/src/test/cpp/util/file_test.cc index 5f6f6eaf11..9683d9dcbe 100644 --- a/src/test/cpp/util/file_test.cc +++ b/src/test/cpp/util/file_test.cc @@ -33,13 +33,13 @@ using std::string; TEST(FileTest, TestSingleThreadedPipe) { std::unique_ptr<IPipe> pipe(CreatePipe()); char buffer[50] = {0}; - ASSERT_TRUE(pipe.get()->Send("hello", 5)); + ASSERT_TRUE(pipe->Send("hello", 5)); int error = -1; - ASSERT_EQ(3, pipe.get()->Receive(buffer, 3, &error)); - ASSERT_TRUE(pipe.get()->Send(" world", 6)); - ASSERT_EQ(5, pipe.get()->Receive(buffer + 3, 5, &error)); + ASSERT_EQ(3, pipe->Receive(buffer, 3, &error)); + ASSERT_TRUE(pipe->Send(" world", 6)); + ASSERT_EQ(5, pipe->Receive(buffer + 3, 5, &error)); ASSERT_EQ(IPipe::SUCCESS, error); - ASSERT_EQ(3, pipe.get()->Receive(buffer + 8, 40, &error)); + ASSERT_EQ(3, pipe->Receive(buffer + 8, 40, &error)); ASSERT_EQ(IPipe::SUCCESS, error); ASSERT_EQ(0, strncmp(buffer, "hello world", 11)); } @@ -48,19 +48,19 @@ TEST(FileTest, TestMultiThreadedPipe) { std::unique_ptr<IPipe> pipe(CreatePipe()); char buffer[50] = {0}; std::thread writer_thread([&pipe]() { - ASSERT_TRUE(pipe.get()->Send("hello", 5)); - ASSERT_TRUE(pipe.get()->Send(" world", 6)); + ASSERT_TRUE(pipe->Send("hello", 5)); + ASSERT_TRUE(pipe->Send(" world", 6)); }); // Wait for all data to be fully written to the pipe. writer_thread.join(); int error = -1; - ASSERT_EQ(3, pipe.get()->Receive(buffer, 3, &error)); + ASSERT_EQ(3, pipe->Receive(buffer, 3, &error)); ASSERT_EQ(IPipe::SUCCESS, error); - ASSERT_EQ(5, pipe.get()->Receive(buffer + 3, 5, &error)); + ASSERT_EQ(5, pipe->Receive(buffer + 3, 5, &error)); ASSERT_EQ(IPipe::SUCCESS, error); - ASSERT_EQ(3, pipe.get()->Receive(buffer + 8, 40, &error)); + ASSERT_EQ(3, pipe->Receive(buffer + 8, 40, &error)); ASSERT_EQ(IPipe::SUCCESS, error); ASSERT_EQ(0, strncmp(buffer, "hello world", 11)); } @@ -149,36 +149,36 @@ TEST(FileTest, TestMtimeHandling) { std::unique_ptr<IFileMtime> mtime(CreateFileMtime()); bool actual = false; - ASSERT_TRUE(mtime.get()->GetIfInDistantFuture(tempdir, &actual)); + ASSERT_TRUE(mtime->GetIfInDistantFuture(tempdir, &actual)); ASSERT_FALSE(actual); // Create a new file, assert its mtime is not in the future. string file(JoinPath(tempdir, "foo.txt")); ASSERT_TRUE(WriteFile("hello", 5, file)); - ASSERT_TRUE(mtime.get()->GetIfInDistantFuture(file, &actual)); + ASSERT_TRUE(mtime->GetIfInDistantFuture(file, &actual)); ASSERT_FALSE(actual); // Set the file's mtime to the future, assert that it's so. - ASSERT_TRUE(mtime.get()->SetToDistantFuture(file)); - ASSERT_TRUE(mtime.get()->GetIfInDistantFuture(file, &actual)); + ASSERT_TRUE(mtime->SetToDistantFuture(file)); + ASSERT_TRUE(mtime->GetIfInDistantFuture(file, &actual)); ASSERT_TRUE(actual); // Overwrite the file, resetting its mtime, assert that GetIfInDistantFuture // notices. ASSERT_TRUE(WriteFile("world", 5, file)); - ASSERT_TRUE(mtime.get()->GetIfInDistantFuture(file, &actual)); + ASSERT_TRUE(mtime->GetIfInDistantFuture(file, &actual)); ASSERT_FALSE(actual); // Set it to the future again so we can reset it using SetToNow. - ASSERT_TRUE(mtime.get()->SetToDistantFuture(file)); - ASSERT_TRUE(mtime.get()->GetIfInDistantFuture(file, &actual)); + ASSERT_TRUE(mtime->SetToDistantFuture(file)); + ASSERT_TRUE(mtime->GetIfInDistantFuture(file, &actual)); ASSERT_TRUE(actual); // Assert that SetToNow resets the timestamp. - ASSERT_TRUE(mtime.get()->SetToNow(file)); - ASSERT_TRUE(mtime.get()->GetIfInDistantFuture(file, &actual)); + ASSERT_TRUE(mtime->SetToNow(file)); + ASSERT_TRUE(mtime->GetIfInDistantFuture(file, &actual)); ASSERT_FALSE(actual); // Delete the file and assert that we can no longer set or query its mtime. ASSERT_TRUE(UnlinkPath(file)); - ASSERT_FALSE(mtime.get()->SetToNow(file)); - ASSERT_FALSE(mtime.get()->SetToDistantFuture(file)); - ASSERT_FALSE(mtime.get()->GetIfInDistantFuture(file, &actual)); + ASSERT_FALSE(mtime->SetToNow(file)); + ASSERT_FALSE(mtime->SetToDistantFuture(file)); + ASSERT_FALSE(mtime->GetIfInDistantFuture(file, &actual)); } TEST(FileTest, TestRenameDirectory) { |