From 8f8a962dcd0d9614d2922271f5f2046011f06d10 Mon Sep 17 00:00:00 2001 From: Jan Kotanski Date: Wed, 22 Jan 2025 16:06:49 +0100 Subject: [PATCH] Issue 650: add Custom to DriverID enum (#665) * add Custom to DriverID enum * add tests * remove DLL_EXPORT --- src/h5cpp/file/driver.hpp | 1 + test/file/driver_test.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/h5cpp/file/driver.hpp b/src/h5cpp/file/driver.hpp index 4bf0624921..828f2b0a63 100644 --- a/src/h5cpp/file/driver.hpp +++ b/src/h5cpp/file/driver.hpp @@ -48,6 +48,7 @@ namespace file //! enum class DriverID : unsigned { + Custom = 0, Posix = 1, Direct = 2, Memory = 3, diff --git a/test/file/driver_test.cpp b/test/file/driver_test.cpp index f07b4f9370..1299ceb286 100644 --- a/test/file/driver_test.cpp +++ b/test/file/driver_test.cpp @@ -34,6 +34,18 @@ using namespace hdf5; + +class MyPosixDriver : public hdf5::file::PosixDriver +{ + public: + MyPosixDriver() {} + + virtual hdf5::file::DriverID id() const noexcept override{ + return hdf5::file::DriverID::Custom; + } +}; + + SCENARIO("Construction of a memory driver instance", "[file,h5cpp,driver]") { GIVEN("a default constructed instance") { file::MemoryDriver m; @@ -99,6 +111,11 @@ SECTION("the posix driver") { REQUIRE(m.id() == file::DriverID::Posix); } + SECTION("the custom driver") { + MyPosixDriver m; + REQUIRE(m.id() == file::DriverID::Custom); +} + #ifdef H5CPP_WITH_MPI SECTION("the MPI driver") {