From 50e07d1c92875e66138d5d5ee3bb46ef237115bb Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Thu, 9 Mar 2023 01:19:08 -0800 Subject: [PATCH] Apply clang-tidy fixes PiperOrigin-RevId: 515265927 Change-Id: Iea11668fa4bbf08f6d418a3823e836fb5b874dcc --- googletest/test/googletest-port-test.cc | 4 ++-- googletest/test/gtest_stress_test.cc | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/googletest/test/googletest-port-test.cc b/googletest/test/googletest-port-test.cc index d01ccaae..1ba3f502 100644 --- a/googletest/test/googletest-port-test.cc +++ b/googletest/test/googletest-port-test.cc @@ -1104,9 +1104,9 @@ TEST(MutexTest, OnlyOneThreadCanLockAtATime) { // Creates and runs kThreadCount threads that increment locked_counter // kCycleCount times each. for (int i = 0; i < kThreadCount; ++i) { - counting_threads[i].reset(new ThreadType( + counting_threads[i] = std::make_unique( &CountingThreadFunc, make_pair(&locked_counter, kCycleCount), - &threads_can_start)); + &threads_can_start); } threads_can_start.Notify(); for (int i = 0; i < kThreadCount; ++i) counting_threads[i]->Join(); diff --git a/googletest/test/gtest_stress_test.cc b/googletest/test/gtest_stress_test.cc index af9733ad..0cf21852 100644 --- a/googletest/test/gtest_stress_test.cc +++ b/googletest/test/gtest_stress_test.cc @@ -30,6 +30,7 @@ // Tests that SCOPED_TRACE() and various Google Test assertions can be // used in a large number of threads concurrently. +#include #include #include "gtest/gtest.h" @@ -118,8 +119,8 @@ TEST(StressTest, CanUseScopedTraceAndAssertionsInManyThreads) { std::unique_ptr > threads[kThreadCount]; Notification threads_can_start; for (int i = 0; i != kThreadCount; i++) - threads[i].reset( - new ThreadWithParam(&ManyAsserts, i, &threads_can_start)); + threads[i] = std::make_unique>(&ManyAsserts, i, + &threads_can_start); threads_can_start.Notify();