Skip to content

Commit d47625c

Browse files
committed
change test to use region as part of status
1 parent 72a3304 commit d47625c

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

cpp/tests/test_smm_model.cpp

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -92,38 +92,37 @@ TEST(TestSMM, evaluateinterregionalAdoptionRate)
9292
using Age = mio::AgeGroup;
9393
using mio::regions::Region;
9494
using Status = mio::Index<Infections, Age, Region>;
95-
using Model = mio::smm::Model<double, Infections, Status>;
95+
using Model = mio::smm::Model<double, Infections, Status, mio::Index<>>;
9696

97-
std::vector<mio::AdoptionRate<double, Status>> adoption_rates;
97+
std::vector<mio::AdoptionRate<double, Status, mio::Index<>>> adoption_rates;
9898
//Second-order adoption
9999
adoption_rates.push_back({{Infections::S, Age(0), Region(0)},
100100
{Infections::I, Age(0), Region(0)},
101-
mio::regions::Region(0),
101+
{},
102102
0.1,
103103
{{{Infections::I, Age(1), Region(0)}, 0.1}, {{Infections::I, Age(1), Region(1)}, 0.2}}});
104104
//First-order adoption
105-
adoption_rates.push_back(
106-
{{Infections::I, Age(1), Region(0)}, {Infections::R, Age(1), Region(0)}, Region(0), 0.2, {}});
107-
Model model({Infections::Count, Age(2), Region(2)}, Region(1));
105+
adoption_rates.push_back({{Infections::I, Age(1), Region(0)}, {Infections::R, Age(1), Region(0)}, {}, 0.2, {}});
106+
Model model({Infections::Count, Age(2), Region(2)}, {});
108107

109-
model.populations[{Region(0), Infections::S, Age(0), Region(0)}] = 50;
110-
model.populations[{Region(0), Infections::I, Age(0), Region(0)}] = 10;
111-
model.populations[{Region(0), Infections::R, Age(0), Region(0)}] = 0;
108+
model.populations[{Infections::S, Age(0), Region(0)}] = 50;
109+
model.populations[{Infections::I, Age(0), Region(0)}] = 10;
110+
model.populations[{Infections::R, Age(0), Region(0)}] = 0;
112111

113-
model.populations[{Region(0), Infections::S, Age(1), Region(0)}] = 100;
114-
model.populations[{Region(0), Infections::I, Age(1), Region(0)}] = 20;
115-
model.populations[{Region(0), Infections::R, Age(1), Region(0)}] = 0;
112+
model.populations[{Infections::S, Age(1), Region(0)}] = 100;
113+
model.populations[{Infections::I, Age(1), Region(0)}] = 20;
114+
model.populations[{Infections::R, Age(1), Region(0)}] = 0;
116115

117-
model.populations[{Region(0), Infections::S, Age(0), Region(1)}] = 40;
118-
model.populations[{Region(0), Infections::I, Age(0), Region(1)}] = 80;
119-
model.populations[{Region(0), Infections::R, Age(0), Region(1)}] = 0;
116+
model.populations[{Infections::S, Age(0), Region(1)}] = 40;
117+
model.populations[{Infections::I, Age(0), Region(1)}] = 80;
118+
model.populations[{Infections::R, Age(0), Region(1)}] = 0;
120119

121-
model.populations[{Region(0), Infections::S, Age(1), Region(1)}] = 80;
122-
model.populations[{Region(0), Infections::I, Age(1), Region(1)}] = 16;
123-
model.populations[{Region(0), Infections::R, Age(1), Region(1)}] = 0;
120+
model.populations[{Infections::S, Age(1), Region(1)}] = 80;
121+
model.populations[{Infections::I, Age(1), Region(1)}] = 16;
122+
model.populations[{Infections::R, Age(1), Region(1)}] = 0;
124123

125124
EXPECT_DOUBLE_EQ(model.evaluate(adoption_rates[0], model.populations.get_compartments()),
126-
0.1 * 50. * (0.1 * 20. * 1. / 120. + 0.2 * 16 * 1. / 96.));
125+
0.1 * 50. * (0.1 * 20. * 1. + 0.2 * 16 * 1.) / (60 + 120 + 120 + 96));
127126
EXPECT_DOUBLE_EQ(model.evaluate(adoption_rates[1], model.populations.get_compartments()), 4.);
128127
}
129128

0 commit comments

Comments
 (0)