Add copy constructor + contains() method to Action::Result

This commit is contained in:
Joakim Hove
2019-11-04 12:51:44 +01:00
parent 53619980c5
commit f33c4f749e
3 changed files with 49 additions and 1 deletions

View File

@@ -754,3 +754,30 @@ TSTEP
}
BOOST_AUTO_TEST_CASE(ACTIONRESULT_COPY_EMPTY) {
Action::Result res1(false);
auto res2 = res1;
BOOST_CHECK(!res1);
BOOST_CHECK(!res2);
BOOST_CHECK(res1.wells() == std::vector<std::string>());
BOOST_CHECK(res2.wells() == std::vector<std::string>());
BOOST_CHECK(!res1.has_well("NO"));
BOOST_CHECK(!res2.has_well("NO"));
}
BOOST_AUTO_TEST_CASE(ACTIONRESULT_COPY_WELLS) {
Action::Result res1(true, {"W1", "W2", "W3"});
auto res2 = res1;
BOOST_CHECK(res1);
BOOST_CHECK(res2);
BOOST_CHECK(!res1.has_well("NO"));
BOOST_CHECK(!res2.has_well("NO"));
for (const auto& w : {"W1", "W2", "W3"}) {
BOOST_CHECK(res1.has_well(w));
BOOST_CHECK(res2.has_well(w));
}
}