Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
SparseAccumulatorTest.cpp
Go to the documentation of this file.
2
3#include "test/storm_gtest.h"
4
5namespace {
6
7TEST(WrappingSetAccumulatorTest, AddWrapAndClear) {
9 ASSERT_TRUE(accumulator.getNonDefaultStates().empty());
10 EXPECT_EQ(0ull, accumulator.getValues()[0]);
11
12 accumulator.addValue(0, 3);
13 accumulator.addValue(0, 67); // 67 % 64 == 3, i.e. the same index as above
14 accumulator.addValue(2, 3);
15 EXPECT_EQ(std::vector<uint64_t>({0, 2}), accumulator.getNonDefaultStates());
16 EXPECT_EQ(1ull << 3, accumulator.getValues()[0]);
17 EXPECT_EQ(accumulator.getValues()[0], accumulator.getValues()[2]); // Both states received the same indices.
18 EXPECT_EQ(0ull, accumulator.getValues()[1]);
19
20 accumulator.addValue(1, 4);
21 accumulator.addValue(1, 63);
22 EXPECT_EQ((1ull << 4) | (1ull << 63), accumulator.getValues()[1]);
23 EXPECT_LT(accumulator.getValues()[0], accumulator.getValues()[1]);
24
25 accumulator.clear();
26 EXPECT_TRUE(accumulator.getNonDefaultStates().empty());
27 for (uint64_t state = 0; state < 4; ++state) {
28 EXPECT_EQ(0ull, accumulator.getValues()[state]) << "state " << state;
29 }
30}
31
32} // namespace
TEST(RegionConstraintCheckerTest, AffineConstraintHoldsThroughout)
SparseAccumulator< uint64_t > WrappingSetAccumulator
Accumulates a set of indices for each state, where only the index modulo 64 is stored,...