From bb3fc4bbdeec7b2f3560317e2e1fde75006910fb Mon Sep 17 00:00:00 2001 From: Luc Grosheintz Date: Tue, 21 Nov 2023 13:19:22 +0100 Subject: [PATCH] Enshrine observable, but quirky behaviour. This isn't desired behaviour. However, it's non-obvious and users might rely on it. Hence, it's being tested. --- tests/unit/tests_high_five_base.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/unit/tests_high_five_base.cpp b/tests/unit/tests_high_five_base.cpp index 929bae9e3..4108de06d 100644 --- a/tests/unit/tests_high_five_base.cpp +++ b/tests/unit/tests_high_five_base.cpp @@ -2508,6 +2508,23 @@ TEST_CASE("HighFivePropertyObjects") { CHECK(plist_g2.isValid()); } +TEST_CASE("HighFivePropertyObjectsQuirks") { + auto pl1 = LinkCreateProps::Default(); + auto pl2 = pl1; + // As usual shallow copying semantics apply: + CHECK(pl1.getId() == pl2.getId()); + + // Then one adds something and the link is broken: + pl2.add(CreateIntermediateGroup(true)); + CHECK(pl1.getId() == H5P_DEFAULT); + + // but once it's not a "special" value, regular shallow copy semantic + // return: + auto pl3 = pl2; + pl3.add(CreateIntermediateGroup(false)); + CHECK(pl3.getId() == pl2.getId()); +} + TEST_CASE("HighFiveLinkCreationOrderProperty") { { // For file const std::string file_name("h5_keep_creation_order_file.h5");