From f6f28b46214ff8e7e9717c1a9314affc8df4981e Mon Sep 17 00:00:00 2001 From: Matthias Volk Date: Wed, 2 Aug 2017 18:03:02 +0200 Subject: [PATCH] Make config from info available --- lib/stormpy/info/__init__.py | 26 ++++++++++++++++++++++++++ tests/info/test_info.py | 8 ++++---- tests/pars/test_parametric.py | 6 ++++-- 3 files changed, 34 insertions(+), 6 deletions(-) diff --git a/lib/stormpy/info/__init__.py b/lib/stormpy/info/__init__.py index d8e3cfa..ffb7e95 100644 --- a/lib/stormpy/info/__init__.py +++ b/lib/stormpy/info/__init__.py @@ -1,2 +1,28 @@ from . import info from .info import * + +from . import _config + + +def storm_version(): + """ + Get storm version. + :return: Storm version + """ + return _config.storm_version + + +def storm_exact_use_cln(): + """ + Check if exact arithmetic in Storm uses CLN. + :return: True if exact arithmetic uses CLN. + """ + return _config.storm_cln_ea + + +def storm_ratfunc_use_cln(): + """ + Check if rational functions in Storm use CLN. + :return: True iff rational functions use CLN. + """ + return _config.storm_cln_rf diff --git a/tests/info/test_info.py b/tests/info/test_info.py index 1545fb0..91e8091 100644 --- a/tests/info/test_info.py +++ b/tests/info/test_info.py @@ -1,9 +1,9 @@ import stormpy -from stormpy.info import info +import stormpy.info class TestInfo: def test_version(self): - assert isinstance(info.Version.short, str) and "." in info.Version.short - assert isinstance(info.Version.long, str) and "Version" in info.Version.long - assert isinstance(info.Version.build_info, str) and "Compiled" in info.Version.build_info + assert isinstance(stormpy.info.Version.short, str) and "." in stormpy.info.Version.short + assert isinstance(stormpy.info.Version.long, str) and "Version" in stormpy.info.Version.long + assert isinstance(stormpy.info.Version.build_info, str) and "Compiled" in stormpy.info.Version.build_info diff --git a/tests/pars/test_parametric.py b/tests/pars/test_parametric.py index dae63b4..24bf5b9 100644 --- a/tests/pars/test_parametric.py +++ b/tests/pars/test_parametric.py @@ -7,8 +7,10 @@ class TestParametric: def test_constraints_collector(self): from pycarl.formula import FormulaType, Relation - import pycarl.cln.formula - import pycarl.gmp.formula + if stormpy.info.storm_ratfunc_use_cln(): + import pycarl.cln.formula + else: + import pycarl.gmp.formula program = stormpy.parse_prism_program(get_example_path("pdtmc", "brp16_2.pm")) prop = "P=? [F s=5]" formulas = stormpy.parse_properties_for_prism_program(prop, program)