cpp: Add unit test for evmc::vm move to itself

This commit is contained in:
Paweł Bylica 2019-07-03 19:04:04 +02:00
parent 1f3243a55e
commit e1ff8cb007
No known key found for this signature in database
GPG Key ID: 7A0C037434FE77EF
1 changed files with 11 additions and 0 deletions

View File

@ -118,6 +118,17 @@ TEST(cpp, vm_move)
EXPECT_FALSE(vm1);
}
EXPECT_EQ(destroy_counter, 4);
{
// Moving to itself will destroy the VM and reset the evmc::vm.
auto v1 = template_instance;
auto vm1 = evmc::vm{&v1};
auto& vm1_ref = vm1;
vm1 = std::move(vm1_ref);
EXPECT_EQ(destroy_counter, 5); // Already destroyed.
EXPECT_FALSE(vm1); // Null.
}
EXPECT_EQ(destroy_counter, 5);
}
TEST(cpp, host)