1#include "storm-config.h"
14TEST(DeterministicModelParserTest, NonExistingFile) {
18 storm::exceptions::FileIoException);
22 storm::exceptions::FileIoException);
25TEST(DeterministicModelParserTest, BasicDtmcParsing) {
28 STORM_TEST_RESOURCES_DIR
"/tra/dtmc_general.tra", STORM_TEST_RESOURCES_DIR
"/lab/dtmc_general.lab",
29 STORM_TEST_RESOURCES_DIR
"/rew/dtmc_general.state.rew", STORM_TEST_RESOURCES_DIR
"/rew/dtmc_general.trans.rew"));
43 for (uint_fast64_t i = 0; i < dtmc.
getRewardModel(
"").getStateRewardVector().size(); i++) {
46 ASSERT_EQ(263.32, rewardSum);
49 ASSERT_EQ(17ul, dtmc.
getRewardModel(
"").getTransitionRewardMatrix().getEntryCount());
51 for (uint_fast64_t i = 0; i < dtmc.
getRewardModel(
"").getTransitionRewardMatrix().getRowCount(); i++) {
52 rewardSum += dtmc.
getRewardModel(
"").getTransitionRewardMatrix().getRowSum(i);
54 ASSERT_EQ(125.4, rewardSum);
57TEST(DeterministicModelParserTest, BasicCtmcParsing) {
60 STORM_TEST_RESOURCES_DIR
"/tra/dtmc_general.tra", STORM_TEST_RESOURCES_DIR
"/lab/dtmc_general.lab",
61 STORM_TEST_RESOURCES_DIR
"/rew/dtmc_general.state.rew", STORM_TEST_RESOURCES_DIR
"/rew/dtmc_general.trans.rew"));
75 for (uint_fast64_t i = 0; i < ctmc.
getRewardModel(
"").getStateRewardVector().size(); i++) {
78 ASSERT_EQ(263.32, rewardSum);
81 ASSERT_EQ(17ul, ctmc.
getRewardModel(
"").getTransitionRewardMatrix().getEntryCount());
83 for (uint_fast64_t i = 0; i < ctmc.
getRewardModel(
"").getTransitionRewardMatrix().getRowCount(); i++) {
84 rewardSum += ctmc.
getRewardModel(
"").getTransitionRewardMatrix().getRowSum(i);
86 ASSERT_EQ(125.4, rewardSum);
89TEST(DeterministicModelParserTest, MismatchedFiles) {
94 STORM_TEST_RESOURCES_DIR
"/lab/dtmc_general.lab"),
95 storm::exceptions::OutOfRangeException);
99 STORM_TEST_RESOURCES_DIR
"/lab/dtmc_mismatched.lab",
100 STORM_TEST_RESOURCES_DIR
"/rew/dtmc_general.state.rew"),
101 storm::exceptions::OutOfRangeException);
105 STORM_TEST_RESOURCES_DIR
"/lab/dtmc_mismatched.lab",
"",
106 STORM_TEST_RESOURCES_DIR
"/rew/dtmc_general.trans.rew"),
107 storm::exceptions::OutOfRangeException);
111 STORM_TEST_RESOURCES_DIR
"/lab/dtmc_mismatched.lab",
"",
112 STORM_TEST_RESOURCES_DIR
"/rew/dtmc_mismatched.trans.rew"),
113 storm::exceptions::OutOfRangeException);
TEST(DeterministicModelParserTest, NonExistingFile)
This class represents a continuous-time Markov chain.
This class represents a discrete-time Markov chain.
std::size_t getNumberOfLabels() const
Returns the number of labels managed by this object.
std::set< std::string > getLabelsOfState(storm::storage::sparse::state_type state) const
Retrieves the set of labels attached to the given state.
virtual bool hasRewardModel(std::string const &rewardModelName) const override
Retrieves whether the model has a reward model with the given name.
storm::models::sparse::StateLabeling const & getStateLabeling() const
Returns the state labeling associated with this model.
virtual uint_fast64_t getNumberOfTransitions() const override
Returns the number of (non-zero) transitions of the model.
virtual uint_fast64_t getNumberOfStates() const override
Returns the number of states of the model.
RewardModelType const & getRewardModel(std::string const &rewardModelName) const
Retrieves the reward model with the given name, if one exists.
storm::storage::BitVector const & getInitialStates() const
Retrieves the initial states of the model.
Loads a deterministic model (Dtmc or Ctmc) from files.
uint_fast64_t getNumberOfSetBits() const
Returns the number of bits that are set to true in this bit vector.
bool get(uint_fast64_t index) const
Retrieves the truth value of the bit at the given index and performs a bound check.
#define STORM_SILENT_ASSERT_THROW(statement, expected_exception)