Adding test to make sure iterators can be incremented after deleting current key.

This commit is contained in:
clemahieu 2014-11-25 17:21:06 -06:00
commit e18df12b5e

View file

@ -195,4 +195,24 @@ TEST (checksum, simple)
store.checksum_del (0x100, 0x10);
rai::block_hash hash3;
ASSERT_TRUE (store.checksum_get (0x100, 0x10, hash3));
}
TEST (block_store, delete_iterator_entry)
{
leveldb::Status init;
rai::block_store store (init, rai::block_store_temp);
ASSERT_TRUE (init.ok ());
rai::send_block block1;
block1.hashables.previous = 1;
store.block_put (block1.hash (), block1);
rai::send_block block2;
block2.hashables.previous = 2;
store.block_put (block2.hash (), block2);
auto current (store.blocks_begin ());
ASSERT_NE (store.blocks_end (), current);
store.block_del (current->first);
++current;
ASSERT_NE (store.blocks_end (), current);
store.block_del (current->first);
ASSERT_EQ (store.blocks_end (), current);
}