Skip to content

Commit

Permalink
Issue 650: add Custom to DriverID enum (#665)
Browse files Browse the repository at this point in the history
* add Custom to DriverID enum

* add tests

* remove DLL_EXPORT
  • Loading branch information
jkotan authored Jan 22, 2025
1 parent 481be76 commit 8f8a962
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/h5cpp/file/driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ namespace file
//!
enum class DriverID : unsigned
{
Custom = 0,
Posix = 1,
Direct = 2,
Memory = 3,
Expand Down
17 changes: 17 additions & 0 deletions test/file/driver_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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") {
Expand Down

0 comments on commit 8f8a962

Please sign in to comment.