this repo has no description
at trunk 25 lines 438 B view raw
1// Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com) 2#include "mutex.h" 3 4#include "gtest/gtest.h" 5 6namespace py { 7 8TEST(MutexTest, TryLockWithBusyLockReturnsFailure) { 9 Mutex mu; 10 mu.lock(); 11 EXPECT_FALSE(mu.tryLock()); 12 13 mu.unlock(); 14} 15 16TEST(MutexTest, ReleaseWithBusyLockAllowsItToBeAcquiredAgain) { 17 Mutex mu; 18 mu.lock(); 19 mu.unlock(); 20 EXPECT_TRUE(mu.tryLock()); 21 22 mu.unlock(); 23} 24 25} // namespace py