CYCAMORE
Loading...
Searching...
No Matches
build/cycamore/manager_inst_tests.cc
Go to the documentation of this file.
1
#include "
manager_inst_tests.h
"
2
3
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
4
TestProducer::TestProducer
(cyclus::Context* ctx) : cyclus::Facility(ctx) {}
5
6
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
7
TestProducer::~TestProducer
() {}
8
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9
void
ManagerInstTests::SetUp
() {
10
ctx_
=
new
cyclus::Context(&
ti_
, &
rec_
);
11
src_inst
=
new
cycamore::ManagerInst
(
ctx_
);
12
producer
=
new
TestProducer
(
ctx_
);
13
commodity
= cyclus::toolkit::Commodity(
"commod"
);
14
capacity
= 5;
15
producer
->cyclus::toolkit::CommodityProducer::Add(
commodity
);
16
producer
->SetCapacity(
commodity
,
capacity
);
17
}
18
19
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
20
void
ManagerInstTests::TearDown
() {
21
delete
producer
;
22
delete
src_inst
;
23
delete
ctx_
;
24
}
25
26
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
27
cyclus::Agent*
ManagerInstitutionConstructor
(cyclus::Context* ctx) {
28
return
new
cycamore::ManagerInst
(ctx);
29
}
30
31
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
32
TEST_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
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
47
TEST_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
57
int
ConnectAgentTests
();
58
static
int
cyclus_agent_tests_connected
=
ConnectAgentTests
();
59
#define CYCLUS_AGENT_TESTS_CONNECTED cyclus_agent_tests_connected
60
#endif
// CYCLUS_AGENT_TESTS_CONNECTED
61
62
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
63
INSTANTIATE_TEST_SUITE_P
(ManagerInst, InstitutionTests,
64
Values(&
ManagerInstitutionConstructor
));
65
INSTANTIATE_TEST_SUITE_P
(ManagerInst, AgentTests,
66
Values(&
ManagerInstitutionConstructor
));
cyclus_agent_tests_connected
static int cyclus_agent_tests_connected
Definition
build/cycamore/manager_inst_tests.cc:58
ManagerInstitutionConstructor
cyclus::Agent * ManagerInstitutionConstructor(cyclus::Context *ctx)
Definition
build/cycamore/manager_inst_tests.cc:27
TEST_F
TEST_F(ManagerInstTests, producerexists)
Definition
build/cycamore/manager_inst_tests.cc:32
INSTANTIATE_TEST_SUITE_P
INSTANTIATE_TEST_SUITE_P(ManagerInst, InstitutionTests, Values(&ManagerInstitutionConstructor))
ConnectAgentTests
int ConnectAgentTests()
manager_inst_tests.h
ManagerInstTests
Definition
build/cycamore/manager_inst_tests.h:42
ManagerInstTests::commodity
cyclus::toolkit::Commodity commodity
Definition
build/cycamore/manager_inst_tests.h:51
ManagerInstTests::producer
TestProducer * producer
Definition
build/cycamore/manager_inst_tests.h:49
ManagerInstTests::src_inst
cycamore::ManagerInst * src_inst
Definition
build/cycamore/manager_inst_tests.h:48
ManagerInstTests::ti_
cyclus::Timer ti_
Definition
build/cycamore/manager_inst_tests.h:54
ManagerInstTests::ctx_
cyclus::Context * ctx_
Definition
build/cycamore/manager_inst_tests.h:53
ManagerInstTests::TearDown
virtual void TearDown()
Definition
build/cycamore/manager_inst_tests.cc:20
ManagerInstTests::capacity
double capacity
Definition
build/cycamore/manager_inst_tests.h:52
ManagerInstTests::rec_
cyclus::Recorder rec_
Definition
build/cycamore/manager_inst_tests.h:55
ManagerInstTests::SetUp
virtual void SetUp()
Definition
build/cycamore/manager_inst_tests.cc:9
TestProducer
Definition
build/cycamore/deploy_inst_tests.h:18
TestProducer::TestProducer
TestProducer(cyclus::Context *ctx)
Definition
build/cycamore/manager_inst_tests.cc:4
TestProducer::~TestProducer
~TestProducer()
Definition
build/cycamore/manager_inst_tests.cc:7
cycamore::ManagerInst
Definition
build/cycamore/manager_inst.h:19
cycamore
manager_inst_tests.cc
Generated by
1.10.0