]> granicus.if.org Git - graphviz/commitdiff
add test of GVContext move assignment
authorMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Sat, 17 Jul 2021 09:04:20 +0000 (11:04 +0200)
committerMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Sat, 7 Aug 2021 04:54:12 +0000 (06:54 +0200)
Towards https://gitlab.com/graphviz/graphviz/-/issues/2001.

tests/test_GVContext_construction.cpp

index 2116d1ea8767cbfa0b31c9c08ee2e54c35046056..a4016d6d2172749c0dd46f8125743b26e702174d 100644 (file)
@@ -24,3 +24,15 @@ TEST_CASE("GVContext can be move constructed") {
   auto other{std::move(gvc)};
   REQUIRE(other.c_struct() == c_ptr);
 }
+
+TEST_CASE("GVContext can be move assigned") {
+  GVC::GVContext gvc;
+  const auto c_ptr = gvc.c_struct();
+  REQUIRE(c_ptr != nullptr);
+  auto other = GVC::GVContext();
+  const auto other_c_ptr = other.c_struct();
+  REQUIRE(other_c_ptr != nullptr);
+  REQUIRE(other_c_ptr != c_ptr);
+  other = std::move(gvc);
+  REQUIRE(other.c_struct() == c_ptr);
+}