[unit-tests] add failing test.

You currently can get a read lock when a write lock is already held.
This commit is contained in:
Joe Thornber 2017-08-14 14:20:59 +01:00
parent 666a32da9c
commit 36169d399c

View File

@ -233,6 +233,13 @@ TEST(BlockTests, concurrent_read_locks)
bm->read_lock(0); bm->read_lock(0);
} }
TEST(BlockTests, no_concurrent_read_and_write_locks)
{
bm4096::ptr bm = create_bm<4096>();
bm4096::write_ref wr = bm->write_lock(0);
ASSERT_THROW(bm->read_lock(0), runtime_error);
}
TEST(BlockTests, read_then_write) TEST(BlockTests, read_then_write)
{ {
bm4096::ptr bm = create_bm<4096>(); bm4096::ptr bm = create_bm<4096>();