Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
DftValidatorTest.cpp
Go to the documentation of this file.
1#include "gmock/gmock.h"
2#include "storm-config.h"
3#include "test/storm_gtest.h"
4
7
8namespace {
9
10TEST(DftValidatorTest, Cyclic) {
11 std::string file = STORM_TEST_RESOURCES_DIR "/dft/cyclic.dft";
12 STORM_SILENT_EXPECT_THROW(storm::dft::api::loadDFTGalileoFile<double>(file), storm::exceptions::WrongFormatException);
13}
14
15TEST(DftValidatorTest, NonBinaryDependency) {
16 std::string file = STORM_TEST_RESOURCES_DIR "/dft/fdep.dft";
17 std::shared_ptr<storm::dft::storage::DFT<double>> dft = storm::dft::api::loadDFTGalileoFile<double>(file);
18 EXPECT_TRUE(storm::dft::api::isWellFormed(*dft, false).first);
19 auto result = storm::dft::api::isWellFormed(*dft, true);
20 EXPECT_FALSE(result.first);
21 EXPECT_THAT(result.second, ::testing::MatchesRegex("DFT has dependency with more than one dependent event."));
22}
23
24TEST(DftValidatorTest, MultipleConstantFailed) {
25 std::string file = STORM_TEST_RESOURCES_DIR "/dft/const_be_test.dft";
26 std::shared_ptr<storm::dft::storage::DFT<double>> dft = storm::dft::api::loadDFTGalileoFile<double>(file);
27 EXPECT_TRUE(storm::dft::api::isWellFormed(*dft, false).first);
28 auto result = storm::dft::api::isWellFormed(*dft, true);
29 EXPECT_FALSE(result.first);
30 EXPECT_THAT(result.second, ::testing::MatchesRegex("DFT has more than one constant failed BE."));
31}
32
33TEST(DftValidatorTest, OverlappingSpareModules) {
34 std::string file = STORM_TEST_RESOURCES_DIR "/dft/spare_overlapping.dft";
35 std::shared_ptr<storm::dft::storage::DFT<double>> dft = storm::dft::api::loadDFTGalileoFile<double>(file);
36 EXPECT_TRUE(storm::dft::api::isWellFormed(*dft, false).first);
37 auto result = storm::dft::api::isWellFormed(*dft, true);
38 EXPECT_FALSE(result.first);
39 EXPECT_THAT(result.second, ::testing::MatchesRegex("Spare modules .* should not overlap."));
40}
41
42TEST(DftValidatorTest, SharedPrimaryModule) {
43 std::string file = STORM_TEST_RESOURCES_DIR "/dft/spare_shared_primary.dft";
44 std::shared_ptr<storm::dft::storage::DFT<double>> dft = storm::dft::api::loadDFTGalileoFile<double>(file);
45 EXPECT_TRUE(storm::dft::api::isWellFormed(*dft, false).first);
46 auto result = storm::dft::api::isWellFormed(*dft, true);
47 EXPECT_FALSE(result.first);
48 EXPECT_THAT(result.second, ::testing::HasSubstr("shared primary module"));
49}
50
51TEST(DftValidatorTest, SpareConstantFailed) {
52 std::string file = STORM_TEST_RESOURCES_DIR "/dft/spare_const_failed.dft";
53 std::shared_ptr<storm::dft::storage::DFT<double>> dft = storm::dft::api::loadDFTGalileoFile<double>(file);
54 EXPECT_TRUE(storm::dft::api::isWellFormed(*dft, false).first);
55 auto result = storm::dft::api::isWellFormed(*dft, true);
56 EXPECT_FALSE(result.first);
57 EXPECT_THAT(result.second, ::testing::MatchesRegex("Spare module of .* contains a constant failed BE .*"));
58}
59
60TEST(DftValidatorTest, NonExponential) {
61 std::string file = STORM_TEST_RESOURCES_DIR "/dft/all_be_distributions.dft";
62 std::shared_ptr<storm::dft::storage::DFT<double>> dft = storm::dft::api::loadDFTGalileoFile<double>(file);
63 EXPECT_TRUE(storm::dft::api::isWellFormed(*dft, false).first);
64 auto result = storm::dft::api::isWellFormed(*dft, true);
65 EXPECT_FALSE(result.first);
66 EXPECT_THAT(result.second, ::testing::HasSubstr("DFT has BE distributions which are neither exponential nor constant failed/failsafe."));
67}
68
69} // namespace
TEST(OrderTest, Simple)
Definition OrderTest.cpp:8
std::pair< bool, std::string > isWellFormed(storm::dft::storage::DFT< ValueType > const &dft, bool validForMarkovianAnalysis=true)
Check whether the DFT is well-formed.
Definition storm-dft.h:64
#define STORM_SILENT_EXPECT_THROW(statement, expected_exception)