diff --git a/resources/examples/testfiles/dft/fdep6.dft b/resources/examples/testfiles/dft/fdep6.dft new file mode 100644 index 000000000..033b73198 --- /dev/null +++ b/resources/examples/testfiles/dft/fdep6.dft @@ -0,0 +1,11 @@ +toplevel "A"; +"A" and "B" "C"; +"B" lambda=1; +"C" lambda=1; +"F1" fdep "O" "B"; +"F2" fdep "O" "C"; +"O" or "S" "T"; +"S" or "T" "D"; +"T" or "E"; +"D" lambda=2; +"E" lambda=4; diff --git a/src/test/storm-dft/simulator/DftSimulatorTest.cpp b/src/test/storm-dft/simulator/DftSimulatorTest.cpp index 9826c8ae3..3bc92bb7f 100644 --- a/src/test/storm-dft/simulator/DftSimulatorTest.cpp +++ b/src/test/storm-dft/simulator/DftSimulatorTest.cpp @@ -41,9 +41,79 @@ namespace { return (double) count / noRuns; } - TEST(DftSimulatorTest, And) { + TEST(DftSimulatorTest, AndUnreliability) { double result = simulateDft(STORM_TEST_RESOURCES_DIR "/dft/and.dft", 2, 10000); EXPECT_NEAR(result, 0.3995764009, 0.01); } + TEST(DftSimulatorTest, OrUnreliability) { + double result = simulateDft(STORM_TEST_RESOURCES_DIR "/dft/or.dft", 1, 10000); + EXPECT_NEAR(result, 0.6321205588, 0.01); + } + + TEST(DftSimulatorTest, VotingUnreliability) { + double result = simulateDft(STORM_TEST_RESOURCES_DIR "/dft/voting.dft", 1, 10000); + EXPECT_NEAR(result, 0.4511883639, 0.01); + result = simulateDft(STORM_TEST_RESOURCES_DIR "/dft/voting2.dft", 1, 10000); + EXPECT_NEAR(result, 0.8173164759, 0.01); + result = simulateDft(STORM_TEST_RESOURCES_DIR "/dft/voting3.dft", 1, 10000); + EXPECT_NEAR(result, 0.3496529873, 0.01); + result = simulateDft(STORM_TEST_RESOURCES_DIR "/dft/voting4.dft", 1, 10000); + EXPECT_NEAR(result, 0.693568287, 0.01); + } + + TEST(DftSimulatorTest, PandUnreliability) { + double result = simulateDft(STORM_TEST_RESOURCES_DIR "/dft/pand.dft", 1, 10000); + EXPECT_NEAR(result, 0.03087312562, 0.01); + } + + TEST(DftSimulatorTest, PorUnreliability) { + double result = simulateDft(STORM_TEST_RESOURCES_DIR "/dft/por.dft", 1, 10000); + EXPECT_NEAR(result, 0.2753355179, 0.01); + } + + TEST(DftSimulatorTest, FdepUnreliability) { + double result = simulateDft(STORM_TEST_RESOURCES_DIR "/dft/fdep.dft", 1, 10000); + EXPECT_NEAR(result, 0.7768698399, 0.01); + result = simulateDft(STORM_TEST_RESOURCES_DIR "/dft/fdep2.dft", 1, 10000); + EXPECT_NEAR(result, 0.3934693403, 0.01); + result = simulateDft(STORM_TEST_RESOURCES_DIR "/dft/fdep3.dft", 1, 10000); + EXPECT_NEAR(result, 0.329679954, 0.01); + result = simulateDft(STORM_TEST_RESOURCES_DIR "/dft/fdep4.dft", 1, 10000); + EXPECT_NEAR(result, 0.601280086, 0.01); + result = simulateDft(STORM_TEST_RESOURCES_DIR "/dft/fdep5.dft", 1, 10000); + EXPECT_NEAR(result, 0.1548181217, 0.01); + result = simulateDft(STORM_TEST_RESOURCES_DIR "/dft/fdep6.dft", 1, 10000); + EXPECT_NEAR(result, 0.9985116987, 0.01); + } + + TEST(DftSimulatorTest, SpareUnreliability) { + double result = simulateDft(STORM_TEST_RESOURCES_DIR "/dft/spare.dft", 1, 10000); + EXPECT_NEAR(result, 0.1118530638, 0.01); + result = simulateDft(STORM_TEST_RESOURCES_DIR "/dft/spare2.dft", 1, 10000); + EXPECT_NEAR(result, 0.2905027469, 0.01); + result = simulateDft(STORM_TEST_RESOURCES_DIR "/dft/spare3.dft", 1, 10000); + EXPECT_NEAR(result, 0.4660673246, 0.01); + result = simulateDft(STORM_TEST_RESOURCES_DIR "/dft/spare4.dft", 1, 10000); + EXPECT_NEAR(result, 0.01273070783, 0.01); + result = simulateDft(STORM_TEST_RESOURCES_DIR "/dft/spare5.dft", 1, 10000); + EXPECT_NEAR(result, 0.2017690905, 0.01); + result = simulateDft(STORM_TEST_RESOURCES_DIR "/dft/spare6.dft", 1, 10000); + EXPECT_NEAR(result, 0.4693712702, 0.01); + result = simulateDft(STORM_TEST_RESOURCES_DIR "/dft/spare7.dft", 1, 10000); + EXPECT_NEAR(result, 0.06108774525, 0.01); + result = simulateDft(STORM_TEST_RESOURCES_DIR "/dft/spare8.dft", 1, 10000); + EXPECT_NEAR(result, 0.02686144489, 0.01); + } + + TEST(DftSimulatorTest, SymmetryUnreliability) { + double result = simulateDft(STORM_TEST_RESOURCES_DIR "/dft/symmetry6.dft", 1, 10000); + EXPECT_NEAR(result, 0.3421934224, 0.01); + } + + TEST(DftSimulatorTest, HecsUnreliability) { + double result = simulateDft(STORM_TEST_RESOURCES_DIR "/dft/hecs_2_2.dft", 1, 10000); + EXPECT_NEAR(result, 0.00021997582, 0.001); + } + }