Skip to content

Commit

Permalink
Add tests for clone_into.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadden committed Jul 11, 2018
1 parent 528f39d commit 4fdae82
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions unit_tests/id.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,19 @@ TEST_CASE("id_pair", "[id]")
REQUIRE(boost::lexical_cast<std::string>(b) == "(1,2)");
test_different_ids(a, b);
}

TEST_CASE("clone_into", "[id]")
{
id_interface* storage = 0;
auto zero = make_id(0);
auto abc = make_id(string("abc"));
auto one = make_id(1);
clone_into(storage, &zero);
REQUIRE(*storage == zero);
clone_into(storage, &one);
REQUIRE(*storage == one);
clone_into(storage, &abc);
REQUIRE(*storage == abc);
clone_into(storage, nullptr);
REQUIRE(storage == nullptr);
}

0 comments on commit 4fdae82

Please sign in to comment.