summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2023-03-09 09:19:08 (GMT)
committerCopybara-Service <copybara-worker@google.com>2023-03-09 09:19:58 (GMT)
commit50e07d1c92875e66138d5d5ee3bb46ef237115bb (patch)
tree18d9f2215d67635f1ccc051b0aabb584c60100cd
parent48a1b110583dd55e5076952b2acd772d9aaf6372 (diff)
downloadgoogletest-50e07d1c92875e66138d5d5ee3bb46ef237115bb.zip
googletest-50e07d1c92875e66138d5d5ee3bb46ef237115bb.tar.gz
googletest-50e07d1c92875e66138d5d5ee3bb46ef237115bb.tar.bz2
Apply clang-tidy fixes
PiperOrigin-RevId: 515265927 Change-Id: Iea11668fa4bbf08f6d418a3823e836fb5b874dcc
-rw-r--r--googletest/test/googletest-port-test.cc4
-rw-r--r--googletest/test/gtest_stress_test.cc5
2 files changed, 5 insertions, 4 deletions
diff --git a/googletest/test/googletest-port-test.cc b/googletest/test/googletest-port-test.cc
index d01ccaa..1ba3f50 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<ThreadType>(
&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 af9733a..0cf2185 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 <memory>
#include <vector>
#include "gtest/gtest.h"
@@ -118,8 +119,8 @@ TEST(StressTest, CanUseScopedTraceAndAssertionsInManyThreads) {
std::unique_ptr<ThreadWithParam<int> > threads[kThreadCount];
Notification threads_can_start;
for (int i = 0; i != kThreadCount; i++)
- threads[i].reset(
- new ThreadWithParam<int>(&ManyAsserts, i, &threads_can_start));
+ threads[i] = std::make_unique<ThreadWithParam<int>>(&ManyAsserts, i,
+ &threads_can_start);
threads_can_start.Notify();