Skip to content

Commit 839134f

Browse files
committed
Checkout outputs too.
1 parent fd230a7 commit 839134f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

mutex_protected_test.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ TEST(CondVarMutexProtectedTest, ConditionVariableWorks) {
461461
TEST(CondVarMutexProtectedTest, ConditionVariableAnyWorks) {
462462
mutex_protected<int, std::shared_mutex> data = 0;
463463
std::condition_variable_any cv;
464+
mutex_protected<int> out = 0;
464465

465466
const int thread_count = 2;
466467

@@ -471,6 +472,7 @@ TEST(CondVarMutexProtectedTest, ConditionVariableAnyWorks) {
471472
auto locked = data.lock_shared();
472473
cv.wait(*locked.mutex(), [&locked]() { return *locked > 0; });
473474
EXPECT_EQ(*locked, 1);
475+
*out.lock() += *locked;
474476
});
475477
}
476478

@@ -480,6 +482,7 @@ TEST(CondVarMutexProtectedTest, ConditionVariableAnyWorks) {
480482
for (auto& thread : threads) {
481483
thread.join();
482484
}
485+
EXPECT_EQ(*out.lock(), thread_count);
483486
}
484487

485488
} // namespace xyz

0 commit comments

Comments
 (0)