From 20b8f3bcea4e2a21c573981e5519619813caf48f Mon Sep 17 00:00:00 2001 From: Ricardo Abreu Date: Mon, 16 Oct 2023 23:08:28 +0100 Subject: [PATCH] [test] Check parent properties --- tests/test_base_snapshot.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_base_snapshot.cpp b/tests/test_base_snapshot.cpp index c7fb591665d..9e900b738ec 100644 --- a/tests/test_base_snapshot.cpp +++ b/tests/test_base_snapshot.cpp @@ -137,4 +137,18 @@ TEST_F(TestBaseSnapshot, adopts_next_index) auto snapshot = MockBaseSnapshot{"tau", "ceti", nullptr, specs, vm}; EXPECT_EQ(snapshot.get_index(), count + 1); } + +TEST_F(TestBaseSnapshot, retrieves_parents_properties) +{ + int parent_index = 11; + std::string parent_name = "parent"; + + EXPECT_CALL(vm, get_snapshot_count).WillOnce(Return(parent_index - 1)).WillOnce(Return(31)); + + auto parent = std::make_shared(parent_name, "", nullptr, specs, vm); + + auto child = MockBaseSnapshot{"child", "", parent, specs, vm}; + EXPECT_EQ(child.get_parents_index(), parent_index); + EXPECT_EQ(child.get_parents_name(), parent_name); +} } // namespace