void Starts1() { vmd::ex::Starts base; vmd::Activities::result_t lst; base.processChanges(0.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); base.processChanges(1.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); base.setActivityDone("B", 0.0); base.processChanges(2.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); lst = base.endedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); base.setActivityDone("A", 0.0); base.processChanges(3.0); lst = base.endedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); }
void EqualFail() { vmd::ex::Equal base; vmd::Activities::result_t lst; base.processChanges(0.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); base.processChanges(1.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); base.setActivityDone("A", 2.0); base.processChanges(2.0); lst = base.endedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); base.processChanges(2.1); lst = base.endedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); lst = base.failedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); }
void activitiesExist() { vle::Init app; vmd::ex::KB4 base; bool b = base.activities().exist("A"); EnsuresEqual(b, true); b = base.activities().exist("Z"); EnsuresEqual(b, false); }
void kb3() { vle::Init app; vmd::ex::KnowledgeBaseGraph2 base; vmd::Activities::result_t lst; base.processChanges(0.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); base.setActivityDone("A", 0.0); base.processChanges(0.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); base.processChanges(0.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); base.setActivityDone("B", 0.0); base.processChanges(0.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); base.processChanges(0.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); base.setActivityDone("C", 0.0); base.processChanges(0.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); base.processChanges(0.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); base.setActivityDone("D", 0.0); base.processChanges(0.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); base.setActivityDone("E", 0.0); base.processChanges(0.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); base.setActivityDone("F", 0.0); base.processChanges(0.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); }
void Starts2() { vmd::ex::StartsFailed base; vmd::Activities::result_t lst; base.processChanges(0.0); lst = base.waitedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); base.processChanges(1.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); }
/****************** * unit test of QSS2 on lotka_volterra model, * based on powerdevs results * * note: results have to be the same as test_QSS2_LotkaVolterra ******************/ void test_QSS2_LotkaVolterraXY() { auto ctx = vu::make_context(); std::cout << " test_QSS2_LotkaVolterraXY " << std::endl; vle::utils::Package pack(ctx, "vle.ode_test"); std::unique_ptr<vz::Vpz> vpz(new vz::Vpz(pack.getExpFile("LotkaVolterraXY.vpz", vle::utils::PKG_BINARY))); ttconfOutputPlugins(*vpz); { std::vector<std::string> conds; conds.push_back("condLV"); conds.push_back("condQSS2"); conds.push_back("condQSS2_X"); ttattachConditions(*vpz,conds,"LotkaVolterraX"); } { std::vector<std::string> conds; conds.push_back("condLV"); conds.push_back("condQSS2"); conds.push_back("condQSS2_Y"); ttattachConditions(*vpz,conds,"LotkaVolterraY"); } //simulation vm::Error error; vm::Simulation sim(ctx, vm::LOG_NONE, vm::SIMULATION_NONE, std::chrono::milliseconds(0), &std::cout); std::unique_ptr<va::Map> out = sim.run(std::move(vpz), &error); //checks that simulation has succeeded EnsuresEqual(error.code, 0); //checks the number of views EnsuresEqual(out->size(),1); //checks the selected view const va::Matrix& view = out->getMatrix("view"); EnsuresEqual(view.columns(),3); //note: the number of rows depend on the averaging of sum of 0.01 Ensures(view.rows() <= 15003); Ensures(view.rows() >= 15002); //gets X,Y int colX = ttgetColumnFromView(view, "Top model:LotkaVolterraX", "X"); int colY = ttgetColumnFromView(view, "Top model:LotkaVolterraY", "Y"); //check X,Y line 15000 EnsuresApproximatelyEqual(view.getDouble(colX,15001), 0.69363324986147468, 10e-5); //previous 0.696088281553273 EnsuresApproximatelyEqual(view.getDouble(colY,15001), 0.07761934820509947, 10e-5); //previous 0.0774536442779648 }
void Before1() { vmd::ex::Before base; vmd::Activities::result_t lst; base.processChanges(0.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); lst = base.waitedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); base.processChanges(1.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); lst = base.waitedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); base.processChanges(2.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); lst = base.waitedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); base.processChanges(3.0); lst = base.failedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); base.processChanges(4.0); lst = base.failedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); }
void parser() { vle::Init app; vmd::ex::KnowledgeBase b; b.plan().fill(std::string(vmd::ex::Plan1)); EnsuresEqual(b.activities().size(), (vmd::Activities::size_type)8); EnsuresEqual( b.activities().get("activity2")->second.rules().size(), 2); EnsuresEqual( b.activities().get("activity5")->second.rules().get("rule 4").isAvailable(), false); }
void test_stringdates() { vle::Init app; vmd::ex::KnowledgeBase b; b.plan().fill(std::string(vmd::ex::Plan1)); const vmd::Activity& act6 = b.activities().get("activity6")->second; const vmd::Activity& act7 = b.activities().get("activity7")->second; EnsuresEqual(act6.start(),act7.start()); EnsuresEqual(act6.start(),2451698); EnsuresEqual(act6.finish(),act7.finish()); EnsuresEqual(act6.finish(),2451699); }
void Activities_test_slot_function() { vle::Init app; vmd::ex::KB5 base; vmd::Activities::result_t lst; EnsuresApproximatelyEqual((double)base.duration(0.), 0., 1.); base.processChanges(0.); base.setActivityDone("A", 0.5); EnsuresApproximatelyEqual((double)base.duration(.5), .5, 1.); base.processChanges(1.); base.setActivityDone("B", 1.); EnsuresApproximatelyEqual((double)base.duration(1.), 0., 1.); base.processChanges(1.); base.setActivityDone("C", 1.5); EnsuresApproximatelyEqual((double)base.duration(1.5), .5, 1.); base.processChanges(2.); base.setActivityDone("D", 2.5); EnsuresApproximatelyEqual((double)base.duration(2.5), .5, 1.); base.processChanges(3.); base.setActivityDone("E", 3.5); EnsuresApproximatelyEqual((double)base.duration(3.5), .5, 1.); base.processChanges(4.); base.setActivityDone("F", 4.5); base.processChanges(5.); // All activity switch from wait to start and from start to end. EnsuresEqual(base.getNumberOfUpdate(), 12); std::cout << vle::utils::format("%i %i\n", base.getNumberOfOut(), base.getNumberOfUpdate()); }
/****************** * Unit test based on powerdevs ******************/ void test_QSS2_Seir() { auto ctx = vu::make_context(); std::cout << " test_QSS2_Seir " << std::endl; vle::utils::Package pack(ctx, "vle.ode_test"); std::unique_ptr<vz::Vpz> vpz(new vz::Vpz(pack.getExpFile("Seir.vpz", vle::utils::PKG_BINARY))); ttconfOutputPlugins(*vpz); std::vector<std::string> conds; conds.push_back("condQSS2"); conds.push_back("condSeir"); ttattachConditions(*vpz,conds,"Seir"); //simulation vm::Error error; vm::Simulation sim(ctx, vm::LOG_NONE, vm::SIMULATION_NONE, std::chrono::milliseconds(0), &std::cout); std::unique_ptr<va::Map> out = sim.run(std::move(vpz), &error); //checks that simulation has succeeded EnsuresEqual(error.code, 0); //checks the number of views EnsuresEqual(out->size(),1); //checks the selected view const va::Matrix& view = out->getMatrix("view"); EnsuresEqual(view.columns(),5); //note: the number of rows depend on the averaging of sum of 0.01 Ensures(view.rows() <= 1503); Ensures(view.rows() >= 1502); //gets S,E,I,R int colS = ttgetColumnFromView(view, "Top model:Seir", "S"); int colE = ttgetColumnFromView(view, "Top model:Seir", "E"); int colI = ttgetColumnFromView(view, "Top model:Seir", "I"); int colR = ttgetColumnFromView(view, "Top model:Seir", "R"); //check S,E,I,R line 1500 EnsuresApproximatelyEqual(view.getDouble(colS,1501), 0.636836529382071, 10e-5); EnsuresApproximatelyEqual(view.getDouble(colE,1501), 0.636051925651117, 10e-5); EnsuresApproximatelyEqual(view.getDouble(colI,1501), 2.95405622447345, 10e-5); EnsuresApproximatelyEqual(view.getDouble(colR,1501), 6.77305532047774, 10e-5); }
void test_relativedates() { vle::Init app; { vmd::ex::KnowledgeBase b; b.plan().fill(std::string(vmd::ex::Plan1), 0); const vmd::Activity& act8 = b.activities().get("activity8")->second; EnsuresEqual(act8.start(),10.0); EnsuresEqual(act8.finish(),23.5); } { vmd::ex::KnowledgeBase b; b.plan().fill(std::string(vmd::ex::Plan1), 5); const vmd::Activity& act8 = b.activities().get("activity8")->second; EnsuresEqual(act8.start(),15.0); EnsuresEqual(act8.finish(),28.5); } }
/****************** * Unit test for testing coupling of different integration methods and * simultaneous perturbations, only the success of simulation is * tested ******************/ void test_coupling() { auto ctx = vu::make_context(); std::cout << " test_coupling " << std::endl; vle::utils::Package pack(ctx, "vle.ode_test"); std::unique_ptr<vz::Vpz> vpz(new vz::Vpz( pack.getExpFile("PerturbSeirXY.vpz", vle::utils::PKG_BINARY))); ttconfOutputPlugins(*vpz); //simulation vm::Error error; vm::Simulation sim(ctx, vm::LOG_NONE, vm::SIMULATION_NONE, std::chrono::milliseconds(0), &std::cout); std::unique_ptr<va::Map> out = sim.run(std::move(vpz), &error); //checks that simulation has succeeded EnsuresEqual(error.code, 0); //checks the number of views EnsuresEqual(out->size(),1); }
void kb2() { vle::Init app; vmd::ex::KnowledgeBaseGraph base; vmd::Activities::result_t lst; base.processChanges(0.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); base.processChanges(0.0); lst = base.waitedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(3)); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); for (vmd::Activities::result_t::iterator it = lst.begin(); it != lst.end(); ++it) { (*it)->second.end(0.0); } base.processChanges(0.0); lst = base.waitedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); for (vmd::Activities::result_t::iterator it = lst.begin(); it != lst.end(); ++it) { (*it)->second.end(0.0); } base.processChanges(0.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); for (vmd::Activities::result_t::iterator it = lst.begin(); it != lst.end(); ++it) { (*it)->second.end(0.0); } lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); }
void Overlaps2() { vmd::ex::Overlaps base; vmd::Activities::result_t lst; base.processChanges(0.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); lst = base.waitedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); base.processChanges(1.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); base.processChanges(2.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); base.processChanges(3.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); base.setActivityDone("A", 3.0); base.processChanges(4.0); lst = base.endedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); base.setActivityDone("B", 4.0); base.processChanges(5.0); lst = base.endedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); }
void kb() { vle::Init app; vmd::ex::KnowledgeBase base; vmd::Activities::result_t lst; double date = 0.0; EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(0)); ++date; base.applyFact("today", vle::value::Double(16)); base.processChanges(date); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(0)); ++date; base.applyFact("today", vle::value::Double(21)); base.processChanges(date); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); ++date; base.applyFact("today", vle::value::Double(18)); base.processChanges(date); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); lst = base.waitedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); lst = base.failedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); ++date; base.applyFact("today", vle::value::Double(22)); base.processChanges(date); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); }
/****************** * Unit test based on deSolve R package * see R/check.R function test_Euler_Seir * * Note: we test that the version of Seir based on four * differential_equation (SeirXY.vpz) gets the same results * in the case of Euler integration ******************/ void test_Euler_SeirXY() { auto ctx = vu::make_context(); std::cout << " test_Euler_SeirXY " << std::endl; vle::utils::Package pack(ctx, "vle.ode_test"); std::unique_ptr<vz::Vpz> vpz(new vz::Vpz(pack.getExpFile("SeirXY.vpz", vle::utils::PKG_BINARY))); //set all output plugin to storage vz::Outputs::iterator itb = vpz->project().experiment().views().outputs().begin(); vz::Outputs::iterator ite = vpz->project().experiment().views().outputs().end(); for(;itb!=ite;itb++) { std::unique_ptr<va::Map> configOutput(new va::Map()); configOutput->addInt("rows",10000); configOutput->addInt("inc_rows",10000); configOutput->addString("header","top"); vz::Output& output = itb->second; output.setStream("", "storage", "vle.output"); output.setData(std::move(configOutput)); } //attach condition condEuler and condLV to atomics models std::vector<std::string> conds; { conds.clear(); conds.push_back("condEuler"); conds.push_back("condSeir"); vz::Model& vpz_mod = vpz->project().model(); vz::BaseModel* mdl = vpz_mod.node()->findModelFromPath("Sm"); Ensures(mdl != 0); vz::AtomicModel* atomg = mdl->toAtomic(); atomg->setConditions(conds); } { conds.clear(); conds.push_back("condEuler"); conds.push_back("condSeir"); vz::Model& vpz_mod = vpz->project().model(); vz::BaseModel* mdl = vpz_mod.node()->findModelFromPath("Em"); Ensures(mdl != 0); vz::AtomicModel* atomg = mdl->toAtomic(); atomg->setConditions(conds); } { conds.clear(); conds.push_back("condEuler"); conds.push_back("condSeir"); vz::Model& vpz_mod = vpz->project().model(); vz::BaseModel* mdl = vpz_mod.node()->findModelFromPath("Im"); Ensures(mdl != 0); vz::AtomicModel* atomg = mdl->toAtomic(); atomg->setConditions(conds); } { conds.clear(); conds.push_back("condEuler"); conds.push_back("condSeir"); vz::Model& vpz_mod = vpz->project().model(); vz::BaseModel* mdl = vpz_mod.node()->findModelFromPath("Rm"); Ensures(mdl != 0); vz::AtomicModel* atomg = mdl->toAtomic(); atomg->setConditions(conds); } //simulation vm::Error error; vm::Simulation sim(ctx, vm::LOG_NONE, vm::SIMULATION_NONE, std::chrono::milliseconds(0), &std::cout); std::unique_ptr<va::Map> out = sim.run(std::move(vpz), &error); //checks that simulation has succeeded EnsuresEqual(error.code, 0); //checks the number of views EnsuresEqual(out->size(),1); //checks the selected view const va::Matrix& view = out->getMatrix("view"); //note: the number of rows depend on the averaging of sum of 0.01 Ensures(view.rows() <= 1503); Ensures(view.rows() >= 1502); //gets S,E,I,R int colS = ttgetColumnFromView(view, "Top model:Sm", "S"); int colE = ttgetColumnFromView(view, "Top model:Em", "E"); int colI = ttgetColumnFromView(view, "Top model:Im", "I"); int colR = ttgetColumnFromView(view, "Top model:Rm", "R"); //check S,E,I,R line 1501 EnsuresApproximatelyEqual(view.getDouble(colS,1501), 0.634334231496758, 10e-5); EnsuresApproximatelyEqual(view.getDouble(colE,1501), 0.65430775343564, 10e-5); EnsuresApproximatelyEqual(view.getDouble(colI,1501), 2.97798653683738, 10e-5); EnsuresApproximatelyEqual(view.getDouble(colR,1501), 6.73337147823022, 10e-5); }
void Before2() { vmd::ex::Before base; vmd::Activities::result_t lst; base.processChanges(0.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); lst = base.waitedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); base.processChanges(1.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); lst = base.waitedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); base.setActivityDone("A", 1.0); base.processChanges(2.0); lst = base.endedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); lst = base.waitedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); base.processChanges(3.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); base.processChanges(4.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); base.processChanges(5.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); base.processChanges(5.1); lst = base.failedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); base.processChanges(6.0); lst = base.failedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); }
/****************** * Unit test based on deSolve R package * see R/check.R function test_Euler_LotkaVolterra ******************/ void test_Euler_LotkaVolterra() { auto ctx = vu::make_context(); std::cout << " test_Euler_LotkaVolterra " << std::endl; vle::utils::Package pack(ctx, "vle.ode_test"); std::unique_ptr<vz::Vpz> vpz(new vz::Vpz( pack.getExpFile("LotkaVolterra.vpz", vle::utils::PKG_BINARY))); //set all output plugin to storage vz::Outputs::iterator itb = vpz->project().experiment().views().outputs().begin(); vz::Outputs::iterator ite = vpz->project().experiment().views().outputs().end(); for(;itb!=ite;itb++) { std::unique_ptr<va::Map> configOutput(new va::Map()); configOutput->addInt("rows",10000); configOutput->addInt("inc_rows",10000); configOutput->addString("header","top"); vz::Output& output = itb->second; output.setStream("", "storage", "vle.output"); output.setData(std::move(configOutput)); } //attach condition condEuler and condLV std::vector<std::string> conds; conds.push_back("condEuler"); conds.push_back("condLV"); vz::Model& vpz_mod = vpz->project().model(); vz::BaseModel* mdl = vpz_mod.node()->findModelFromPath("LotkaVolterra"); Ensures(mdl != 0); vz::AtomicModel* atomg = mdl->toAtomic(); atomg->setConditions(conds); //simulation vm::Error error; vm::Simulation sim(ctx, vm::LOG_NONE, vm::SIMULATION_NONE, std::chrono::milliseconds(0), &std::cout); std::unique_ptr<va::Map> out = sim.run(std::move(vpz), &error); //checks that simulation has succeeded EnsuresEqual(error.code, 0); //checks the number of views EnsuresEqual(out->size(),1); //checks the selected view const va::Matrix& view = out->getMatrix("view"); EnsuresEqual(view.columns(),3); //note: the number of rows depend on the averaging of sum of 0.01 Ensures(view.rows() <= 15003); Ensures(view.rows() >= 15002); //gets X,Y int colX = ttgetColumnFromView(view, "Top model:LotkaVolterra", "X"); int colY = ttgetColumnFromView(view, "Top model:LotkaVolterra", "Y"); //check X,Y line 10 EnsuresApproximatelyEqual(view.getDouble(colX,10), 9.677077, 10e-5); EnsuresApproximatelyEqual(view.getDouble(colY,10), 5.317209, 10e-5); //check X,Y line 30 EnsuresApproximatelyEqual(view.getDouble(colX,30), 8.903716, 10e-5); EnsuresApproximatelyEqual(view.getDouble(colY,30), 6.030680, 10e-5); //check X,Y line 15000 EnsuresApproximatelyEqual(view.getDouble(colX,15000), 0.5528446, 10e-5); EnsuresApproximatelyEqual(view.getDouble(colY,15000), 0.09330513, 10e-5); }
void During1() { vmd::ex::During base; vmd::Activities::result_t lst; base.processChanges(0.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); lst = base.waitedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); base.processChanges(1.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); base.processChanges(2.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); base.processChanges(3.0); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(2)); base.setActivityDone("A", 3.0); base.processChanges(4.0); lst = base.endedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(0)); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); lst = base.failedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); base.processChanges(5.0); lst = base.endedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(0)); lst = base.startedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); lst = base.failedActivities(); EnsuresEqual(lst.size(), vmd::Activities::result_t::size_type(1)); }