Browse Source

Refactoring of SMT tests

tempestpy_adaptions
Alexander Bork 6 years ago
parent
commit
b89f8f8de4
  1. 19
      src/test/storm-dft/api/DftModelCheckerTest.cpp
  2. 26
      src/test/storm-dft/api/DftSmtTest.cpp

19
src/test/storm-dft/api/DftModelCheckerTest.cpp

@ -2,7 +2,6 @@
#include "storm-config.h" #include "storm-config.h"
#include "storm-dft/api/storm-dft.h" #include "storm-dft/api/storm-dft.h"
#include "storm-dft/modelchecker/dft/DFTASFChecker.h"
#include "storm-parsers/api/storm-parsers.h" #include "storm-parsers/api/storm-parsers.h"
namespace { namespace {
@ -72,17 +71,6 @@ namespace {
return boost::get<double>(results[0]); return boost::get<double>(results[0]);
} }
storm::solver::SmtSolver::CheckResult analyzeSMT(std::string const &file) {
std::shared_ptr<storm::storage::DFT<double>> dft = storm::api::loadDFTGalileoFile<double>(file);
EXPECT_TRUE(storm::api::isWellFormed(*dft));
storm::modelchecker::DFTASFChecker smtChecker(*dft);
smtChecker.convert();
smtChecker.toSolver();
std::vector<storm::solver::SmtSolver::CheckResult> results;
return smtChecker.checkTleNeverFailed();
}
double analyzeReliability(std::string const &file, double bound) { double analyzeReliability(std::string const &file, double bound) {
std::shared_ptr<storm::storage::DFT<double>> dft = storm::api::loadDFTGalileoFile<double>(file); std::shared_ptr<storm::storage::DFT<double>> dft = storm::api::loadDFTGalileoFile<double>(file);
EXPECT_TRUE(storm::api::isWellFormed(*dft)); EXPECT_TRUE(storm::api::isWellFormed(*dft));
@ -211,11 +199,4 @@ namespace {
double result = this->analyzeReliability(STORM_TEST_RESOURCES_DIR "/dft/hecs_2_2.dft", 1.0); double result = this->analyzeReliability(STORM_TEST_RESOURCES_DIR "/dft/hecs_2_2.dft", 1.0);
EXPECT_FLOAT_EQ(result, 0.00021997582); EXPECT_FLOAT_EQ(result, 0.00021997582);
} }
TYPED_TEST(DftModelCheckerTest, SmtTest) {
storm::solver::SmtSolver::CheckResult result = this->analyzeSMT(STORM_TEST_RESOURCES_DIR "/dft/and.dft");
EXPECT_EQ(result, storm::solver::SmtSolver::CheckResult::Unsat);
result = this->analyzeSMT(STORM_TEST_RESOURCES_DIR "/dft/pand.dft");
EXPECT_EQ(result, storm::solver::SmtSolver::CheckResult::Sat);
}
} }

26
src/test/storm-dft/api/DftSmtTest.cpp

@ -0,0 +1,26 @@
#include "gtest/gtest.h"
#include "storm-config.h"
#include "storm-dft/api/storm-dft.h"
namespace {
TEST(DftSmtTest, AndTest) {
std::shared_ptr<storm::storage::DFT<double>> dft =
storm::api::loadDFTGalileoFile<double>(STORM_TEST_RESOURCES_DIR "/dft/and.dft");
EXPECT_TRUE(storm::api::isWellFormed(*dft));
storm::modelchecker::DFTASFChecker smtChecker(*dft);
smtChecker.convert();
smtChecker.toSolver();
EXPECT_EQ(smtChecker.checkTleNeverFailed(), storm::solver::SmtSolver::CheckResult::Unsat);
}
TEST(DftSmtTest, PandTest) {
std::shared_ptr<storm::storage::DFT<double>> dft =
storm::api::loadDFTGalileoFile<double>(STORM_TEST_RESOURCES_DIR "/dft/pand.dft");
EXPECT_TRUE(storm::api::isWellFormed(*dft));
storm::modelchecker::DFTASFChecker smtChecker(*dft);
smtChecker.convert();
smtChecker.toSolver();
EXPECT_EQ(smtChecker.checkTleNeverFailed(), storm::solver::SmtSolver::CheckResult::Sat);
}
}
Loading…
Cancel
Save