From fb3be10b5e365eccb88dcc38a6be5ca47f3ac955 Mon Sep 17 00:00:00 2001 From: Torsten Reuschel <89043237+unbtorsten@users.noreply.github.com> Date: Fri, 20 Oct 2023 03:40:51 -0300 Subject: [PATCH] Improve test code documentation (#832) --- tests/unit/tests_high_five_base.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/unit/tests_high_five_base.cpp b/tests/unit/tests_high_five_base.cpp index f7afcb272..9df63229b 100644 --- a/tests/unit/tests_high_five_base.cpp +++ b/tests/unit/tests_high_five_base.cpp @@ -317,13 +317,21 @@ TEST_CASE("Test allocation time") { CHECK(alloc_size == data.size() * sizeof(decltype(data)::value_type)); } +/* + * Test to ensure legacy support: DataSet used to have a default constructor. + * However, it is not useful to have a DataSet object that does not actually + * refer to a dataset in a file. Hence, the the default constructor was + * deprecated. + * This test is to ensure that the constructor is not accidentally removed and + * thereby break users' code. + */ TEST_CASE("Test default constructors") { const std::string file_name("h5_default_ctors.h5"); const std::string dataset_name("dset"); File file(file_name, File::Truncate); auto ds = file.createDataSet(dataset_name, std::vector{1, 2, 3, 4, 5}); - DataSet d2; // deprecated as it constructs unsafe objects + DataSet d2; // expect deprecation warning, as it constructs unsafe object // d2.getFile(); // runtime error CHECK(!d2.isValid()); d2 = ds; // copy