Browse Source
Added functional tests for scheduler classes.
Added functional tests for scheduler classes.
Former-commit-id: d7f7da5ab0
tempestpy_adaptions
dehnert
11 years ago
4 changed files with 114 additions and 10 deletions
-
8src/storage/TotalScheduler.cpp
-
42test/functional/storage/SchedulerTest.cpp
-
26test/performance/storage/MaximalEndComponentDecompositionTest.cpp
-
48test/performance/storage/StronglyConnectedComponentDecompositionTest.cpp
@ -0,0 +1,42 @@ |
|||
#include "gtest/gtest.h"
|
|||
#include "storm-config.h"
|
|||
#include "src/exceptions/InvalidArgumentException.h"
|
|||
#include "src/storage/PartialScheduler.h"
|
|||
#include "src/storage/TotalScheduler.h"
|
|||
|
|||
TEST(SchedulerTest, PartialScheduler) { |
|||
storm::storage::PartialScheduler scheduler; |
|||
|
|||
ASSERT_NO_THROW(scheduler.setChoice(0, 1)); |
|||
ASSERT_NO_THROW(scheduler.setChoice(0, 3)); |
|||
ASSERT_NO_THROW(scheduler.setChoice(3, 4)); |
|||
|
|||
ASSERT_TRUE(scheduler.isChoiceDefined(0)); |
|||
ASSERT_EQ(3, scheduler.getChoice(0)); |
|||
|
|||
ASSERT_TRUE(scheduler.isChoiceDefined(3)); |
|||
ASSERT_EQ(4, scheduler.getChoice(3)); |
|||
|
|||
ASSERT_FALSE(scheduler.isChoiceDefined(1)); |
|||
ASSERT_THROW(scheduler.getChoice(1), storm::exceptions::InvalidArgumentException); |
|||
} |
|||
|
|||
TEST(SchedulerTest, TotalScheduler) { |
|||
storm::storage::TotalScheduler scheduler(4); |
|||
|
|||
ASSERT_NO_THROW(scheduler.setChoice(0, 1)); |
|||
ASSERT_NO_THROW(scheduler.setChoice(0, 3)); |
|||
ASSERT_NO_THROW(scheduler.setChoice(3, 4)); |
|||
|
|||
ASSERT_TRUE(scheduler.isChoiceDefined(0)); |
|||
ASSERT_EQ(3, scheduler.getChoice(0)); |
|||
|
|||
ASSERT_TRUE(scheduler.isChoiceDefined(3)); |
|||
ASSERT_EQ(4, scheduler.getChoice(3)); |
|||
|
|||
ASSERT_TRUE(scheduler.isChoiceDefined(1)); |
|||
ASSERT_EQ(0, scheduler.getChoice(1)); |
|||
|
|||
ASSERT_THROW(scheduler.getChoice(4), storm::exceptions::InvalidArgumentException); |
|||
ASSERT_THROW(scheduler.setChoice(5, 2), storm::exceptions::InvalidArgumentException); |
|||
} |
@ -0,0 +1,26 @@ |
|||
#include "gtest/gtest.h"
|
|||
#include "storm-config.h"
|
|||
#include "src/parser/AutoParser.h"
|
|||
#include "src/storage/MaximalEndComponentDecomposition.h"
|
|||
|
|||
TEST(MaximalEndComponentDecomposition, AsynchronousLeader) { |
|||
storm::parser::AutoParser<double> parser(STORM_CPP_BASE_PATH "/examples/mdp/asynchronous_leader/leader7.tra", STORM_CPP_BASE_PATH "/examples/mdp/asynchronous_leader/leader7.lab", "", ""); |
|||
std::shared_ptr<storm::models::Mdp<double>> mdp = parser.getModel<storm::models::Mdp<double>>(); |
|||
|
|||
storm::storage::MaximalEndComponentDecomposition<double> mecDecomposition; |
|||
ASSERT_NO_THROW(mecDecomposition = storm::storage::MaximalEndComponentDecomposition<double>(*mdp)); |
|||
|
|||
ASSERT_EQ(7, mecDecomposition.size()); |
|||
mdp = nullptr; |
|||
} |
|||
|
|||
TEST(MaximalEndComponentDecomposition, Consensus) { |
|||
storm::parser::AutoParser<double> parser(STORM_CPP_BASE_PATH "/examples/mdp/consensus/coin6_4.tra", STORM_CPP_BASE_PATH "/examples/mdp/consensus/coin6_4.lab", "", ""); |
|||
std::shared_ptr<storm::models::Mdp<double>> mdp = parser.getModel<storm::models::Mdp<double>>(); |
|||
|
|||
storm::storage::MaximalEndComponentDecomposition<double> mecDecomposition; |
|||
ASSERT_NO_THROW(mecDecomposition = storm::storage::MaximalEndComponentDecomposition<double>(*mdp)); |
|||
|
|||
ASSERT_EQ(384, mecDecomposition.size()); |
|||
mdp = nullptr; |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue