Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
DftSmtTest.cpp
Go to the documentation of this file.
1#include "storm-config.h"
2#include "test/storm_gtest.h"
3
4#include "storm-dft/api/io.h"
9
10namespace {
11class DftSmt : public ::testing::Test {
12 protected:
13 void SetUp() override {
14#ifndef STORM_HAVE_Z3
15 GTEST_SKIP() << "Z3 not available.";
16#endif
17 }
18};
19
20TEST_F(DftSmt, AndTest) {
21 std::shared_ptr<storm::dft::storage::DFT<double>> dft = storm::dft::api::loadDFTGalileoFile<double>(STORM_TEST_RESOURCES_DIR "/dft/and.dft");
22 EXPECT_TRUE(storm::dft::api::isWellFormed(*dft).first);
24 smtChecker.convert();
25 smtChecker.toSolver();
26 EXPECT_EQ(smtChecker.checkTleNeverFailed(), storm::solver::SmtSolver::CheckResult::Unsat);
27}
28
29TEST_F(DftSmt, PandTest) {
30 std::shared_ptr<storm::dft::storage::DFT<double>> dft = storm::dft::api::loadDFTGalileoFile<double>(STORM_TEST_RESOURCES_DIR "/dft/pand.dft");
31 EXPECT_TRUE(storm::dft::api::isWellFormed(*dft).first);
33 smtChecker.convert();
34 smtChecker.toSolver();
35 EXPECT_EQ(smtChecker.checkTleNeverFailed(), storm::solver::SmtSolver::CheckResult::Sat);
36}
37
38TEST_F(DftSmt, SpareTest) {
39 std::shared_ptr<storm::dft::storage::DFT<double>> dft = storm::dft::api::loadDFTGalileoFile<double>(STORM_TEST_RESOURCES_DIR "/dft/spare_two_modules.dft");
40 EXPECT_TRUE(storm::dft::api::isWellFormed(*dft).first);
42 smtChecker.convert();
43 smtChecker.toSolver();
44 EXPECT_EQ(smtChecker.checkTleFailsWithLeq(2), storm::solver::SmtSolver::CheckResult::Unsat);
45 EXPECT_EQ(smtChecker.checkTleFailsWithEq(3), storm::solver::SmtSolver::CheckResult::Sat);
46}
47
48TEST_F(DftSmt, BoundTest) {
49 std::shared_ptr<storm::dft::storage::DFT<double>> dft = storm::dft::api::loadDFTGalileoFile<double>(STORM_TEST_RESOURCES_DIR "/dft/spare5.dft");
50 EXPECT_TRUE(storm::dft::api::isWellFormed(*dft).first);
52 smtChecker.convert();
53 smtChecker.toSolver();
54 EXPECT_EQ(storm::dft::utility::FailureBoundFinder::getLeastFailureBound(*dft, true, 30), uint64_t(2));
55 EXPECT_EQ(storm::dft::utility::FailureBoundFinder::getAlwaysFailedBound(*dft, true, 30), uint64_t(4));
56}
57
58TEST_F(DftSmt, FDEPBoundTest) {
59 std::shared_ptr<storm::dft::storage::DFT<double>> dft = storm::dft::api::loadDFTGalileoFile<double>(STORM_TEST_RESOURCES_DIR "/dft/fdep_bound.dft");
60 EXPECT_TRUE(storm::dft::api::isWellFormed(*dft, false).first);
62 smtChecker.convert();
63 smtChecker.toSolver();
64 EXPECT_EQ(storm::dft::utility::FailureBoundFinder::getLeastFailureBound(*dft, true, 30), uint64_t(1));
65 EXPECT_EQ(storm::dft::utility::FailureBoundFinder::getAlwaysFailedBound(*dft, true, 30), uint64_t(5));
66}
67
68TEST_F(DftSmt, FDEPConflictTest) {
69 std::shared_ptr<storm::dft::storage::DFT<double>> dft =
70 storm::dft::api::loadDFTGalileoFile<double>(STORM_TEST_RESOURCES_DIR "/dft/spare_conflict_test.dft");
71 EXPECT_TRUE(storm::dft::api::isWellFormed(*dft).first);
72 std::vector<bool> true_vector(10, true);
73
76}
77
78TEST_F(DftSmt, FDEPConflictSPARETest) {
79 std::shared_ptr<storm::dft::storage::DFT<double>> dft =
80 storm::dft::api::loadDFTGalileoFile<double>(STORM_TEST_RESOURCES_DIR "/dft/spare_conflict_test.dft");
81 EXPECT_TRUE(storm::dft::api::isWellFormed(*dft).first);
82 std::vector<bool> true_vector(10, true);
83
86}
87
88TEST_F(DftSmt, FDEPConflictSEQTest) {
89 std::shared_ptr<storm::dft::storage::DFT<double>> dft = storm::dft::api::loadDFTGalileoFile<double>(STORM_TEST_RESOURCES_DIR "/dft/seq_conflict_test.dft");
90 EXPECT_TRUE(storm::dft::api::isWellFormed(*dft).first);
91 std::vector<bool> expected_dynamic_vector(dft->nrElements(), true);
92 expected_dynamic_vector.at(dft->getTopLevelIndex()) = false;
93
94 EXPECT_EQ(storm::dft::utility::FDEPConflictFinder<double>::getDynamicBehavior(*dft), expected_dynamic_vector);
95 EXPECT_EQ(storm::dft::utility::FDEPConflictFinder<double>::getDependencyConflicts(*dft, true).size(), uint64_t(3));
96}
97} // namespace
TEST_F(AssumptionCheckerTest, Brp_no_bisimulation)
static std::vector< bool > getDynamicBehavior(storm::dft::storage::DFT< ValueType > const &dft)
static std::vector< std::pair< uint64_t, uint64_t > > getDependencyConflicts(storm::dft::storage::DFT< ValueType > const &dft, bool useSMT=false, uint_fast64_t timeout=10)
Get a vector of index pairs of FDEPs in the DFT which are conflicting.
static uint64_t getLeastFailureBound(storm::dft::storage::DFT< double > const &dft, bool useSMT=false, uint_fast64_t timeout=10)
Get the minimal number of BEs necessary for the TLE to fail (lower bound for number of failures to ch...
static uint64_t getAlwaysFailedBound(storm::dft::storage::DFT< double > const &dft, bool useSMT=false, uint_fast64_t timeout=10)
Get the number of BE failures for which the TLE always fails (upper bound for number of failures to c...
std::shared_ptr< storm::dft::storage::DFT< ValueType > > loadDFTGalileoFile(std::string const &file)
Load DFT from Galileo file.
Definition io.cpp:14
std::pair< bool, std::string > isWellFormed(storm::dft::storage::DFT< ValueType > const &dft, bool validForMarkovianAnalysis)
Check whether the DFT is well-formed.