CYCAMORE
Loading...
Searching...
No Matches
src/manager_inst_tests.cc
Go to the documentation of this file.
2
3// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4TestProducer::TestProducer(cyclus::Context* ctx) : cyclus::Facility(ctx) {}
5
6// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
8// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
10 ctx_ = new cyclus::Context(&ti_, &rec_);
13 commodity = cyclus::toolkit::Commodity("commod");
14 capacity = 5;
15 producer->cyclus::toolkit::CommodityProducer::Add(commodity);
16 producer->SetCapacity(commodity, capacity);
17}
18
19// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
21 delete producer;
22 delete src_inst;
23 delete ctx_;
24}
25
26// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
27cyclus::Agent* ManagerInstitutionConstructor(cyclus::Context* ctx) {
28 return new cycamore::ManagerInst(ctx);
29}
30
31// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
32TEST_F(ManagerInstTests, producerexists) {
33 using std::set;
34 ctx_->AddPrototype("foop", producer);
35 set<cyclus::toolkit::CommodityProducer*>::iterator it;
36 for (it = src_inst->cyclus::toolkit::CommodityProducerManager::
37 producers().begin();
38 it != src_inst->cyclus::toolkit::CommodityProducerManager::
39 producers().end();
40 it++) {
41 EXPECT_EQ(dynamic_cast<TestProducer*>(*it)->prototype(),
42 producer->prototype());
43 }
44}
45
46// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
47TEST_F(ManagerInstTests, productioncapacity) {
48 EXPECT_EQ(src_inst->TotalCapacity(commodity), 0);
49 src_inst->BuildNotify(producer);
50 EXPECT_EQ(src_inst->TotalCapacity(commodity), capacity);
51 src_inst->DecomNotify(producer);
52 EXPECT_EQ(src_inst->TotalCapacity(commodity), 0);
53}
54
55// required to get functionality in cyclus agent unit tests library
56#ifndef CYCLUS_AGENT_TESTS_CONNECTED
59#define CYCLUS_AGENT_TESTS_CONNECTED cyclus_agent_tests_connected
60#endif // CYCLUS_AGENT_TESTS_CONNECTED
61
62// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
63INSTANTIATE_TEST_SUITE_P(ManagerInst, InstitutionTests,
65INSTANTIATE_TEST_SUITE_P(ManagerInst, AgentTests,
cyclus::toolkit::Commodity commodity
cycamore::ManagerInst * src_inst
TestProducer(cyclus::Context *ctx)
static int cyclus_agent_tests_connected
cyclus::Agent * ManagerInstitutionConstructor(cyclus::Context *ctx)
TEST_F(ManagerInstTests, producerexists)
INSTANTIATE_TEST_SUITE_P(ManagerInst, InstitutionTests, Values(&ManagerInstitutionConstructor))
int ConnectAgentTests()