From 2c81318030114df572fb089af39ec27cd48b44fa Mon Sep 17 00:00:00 2001 From: Matthias Volk Date: Thu, 3 Aug 2017 11:29:43 +0200 Subject: [PATCH] Bindings for storm versions --- src/mod_info.cpp | 10 +++++++--- tests/info/test_info.py | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/mod_info.cpp b/src/mod_info.cpp index 22ce45f..be4bb0a 100644 --- a/src/mod_info.cpp +++ b/src/mod_info.cpp @@ -7,8 +7,12 @@ PYBIND11_MODULE(info, m) { py::class_(m, "Version", "Version information for Storm") // static properties are still called with self as argument (which we ignore), see // https://pybind11.readthedocs.io/en/master/advanced/classes.html#static-properties - .def_property_readonly_static("short", [](py::object /* self */){ return storm::utility::StormVersion::shortVersionString(); }, "Storm version in short representation") - .def_property_readonly_static("long", [](py::object /* self */){ return storm::utility::StormVersion::longVersionString(); }, "Storm version in long representation") - .def_property_readonly_static("build_info", [](py::object /* self */){ return storm::utility::StormVersion::buildInfo(); }, "Build info for Storm") + .def_property_readonly_static("major", [](py::object /* self */){ return storm::utility::StormVersion::versionMajor; }, "Storm major version.") + .def_property_readonly_static("minor", [](py::object /* self */){ return storm::utility::StormVersion::versionMinor; }, "Storm minor version.") + .def_property_readonly_static("patch", [](py::object /* self */){ return storm::utility::StormVersion::versionPatch; }, "Storm patch version.") + .def_property_readonly_static("development", [](py::object /* self */){ return storm::utility::StormVersion::versionDev; }, "Flag if Storm is development version.") + .def_property_readonly_static("short", [](py::object /* self */){ return storm::utility::StormVersion::shortVersionString(); }, "Storm version in short representation.") + .def_property_readonly_static("long", [](py::object /* self */){ return storm::utility::StormVersion::longVersionString(); }, "Storm version in long representation.") + .def_property_readonly_static("build_info", [](py::object /* self */){ return storm::utility::StormVersion::buildInfo(); }, "Build info for Storm.") ; } diff --git a/tests/info/test_info.py b/tests/info/test_info.py index 25bbaf0..d715ad2 100644 --- a/tests/info/test_info.py +++ b/tests/info/test_info.py @@ -9,4 +9,6 @@ class TestInfo: assert isinstance(stormpy.info.Version.build_info, str) and "Compiled" in stormpy.info.Version.build_info def test_version_equal(self): - assert stormpy.info.Version.short == stormpy.info.storm_version() + assert stormpy.info.storm_version() in stormpy.info.Version.short + assert (stormpy.info.Version.development and stormpy.info.Version.short.endswith( + " (dev)")) or not stormpy.info.Version.development