commodconverter
 All Classes Namespaces Files Functions Variables Macros
build/CommodConverter/commodconverter_tests.cc
Go to the documentation of this file.
1 #include <gtest/gtest.h>
2 
4 
5 namespace commodconverter {
6 
7 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
9  src_facility_ = new CommodConverter(tc_.get());
12 }
13 
15  delete src_facility_;
16 }
17 
19  in_c1 = "in_c1";
20  out_c1 = "out_c1";
21  in_r1 = "in_r1";
22  out_r1 = "out_r1";
23  process_time = 10;
24  max_inv_size = 200;
25  capacity = 20;
26  cost = 1;
27 
28  cyclus::CompMap v;
29  v[922350000] = 1;
30  v[922380000] = 2;
31  cyclus::Composition::Ptr recipe = cyclus::Composition::CreateFromAtom(v);
32  tc_.get()->AddRecipe(in_r1, recipe);
33 
34  v[94239] = 0.25;
35  recipe = cyclus::Composition::CreateFromAtom(v);
36  tc_.get()->AddRecipe(out_r1, recipe);
37 }
38 
48 }
49 
51  EXPECT_EQ(process_time, fac->process_time_());
52  EXPECT_EQ(max_inv_size, fac->max_inv_size_());
53  EXPECT_EQ(capacity, fac->capacity_());
54  EXPECT_EQ(out_c1, fac->out_commod_());
55  EXPECT_EQ(out_r1, fac->out_recipe_());
56  EXPECT_EQ(in_c1, fac->in_commod_());
57  EXPECT_EQ(in_r1, fac->in_recipe_());
58  EXPECT_EQ(cost, fac->cost_());
59 }
60 
61 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
63  CommodConverter* cloned_fac =
64  dynamic_cast<CommodConverter*> (src_facility_->Clone());
65  TestInitState(cloned_fac);
66 }
67 
68 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
69 TEST_F(CommodConverterTest, InitialState) {
70  // Test things about the initial state of the facility here
71  TestInitState(src_facility_);
72 }
73 
74 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
76  EXPECT_NO_THROW(std::string s = src_facility_->str());
77  // Test CommodConverter specific aspects of the print method here
78 }
79 
80 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
82  ASSERT_NO_THROW(src_facility_->Tick());
83  // Test CommodConverter specific behaviors of the Tick function here
84 }
85 
86 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
88  EXPECT_NO_THROW(src_facility_->Tock());
89  // Test CommodConverter specific behaviors of the Tock function here
90 }
91 
92 } // namespace commodconverter
93 
94 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
95 cyclus::Agent* CommodConverterConstructor(cyclus::Context* ctx) {
96  return new commodconverter::CommodConverter(ctx);
97 }
98 
99 // required to get functionality in cyclus agent unit tests library
100 #ifndef CYCLUS_AGENT_TESTS_CONNECTED
101 int ConnectAgentTests();
103 #define CYCLUS_AGENT_TESTS_CONNECTED cyclus_agent_tests_connected
104 #endif // CYCLUS_AGENT_TESTS_CONNECTED
105 
106 // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
107 INSTANTIATE_TEST_CASE_P(CommodConverterFac, FacilityTests,
108  ::testing::Values(&CommodConverterConstructor));
109 
110 INSTANTIATE_TEST_CASE_P(CommodConverterFac, AgentTests,
111  ::testing::Values(&CommodConverterConstructor));
void capacity_(double c)
the maximum amount processed per timestep
void in_commod_(std::string c)
the in commodity
void TestInitState(commodconverter::CommodConverter *fac)
INSTANTIATE_TEST_CASE_P(CommodConverterFac, FacilityTests,::testing::Values(&CommodConverterConstructor))
int ConnectAgentTests()
cyclus::Agent * CommodConverterConstructor(cyclus::Context *ctx)
void cost_(double c)
the cost per unit out_commod
void process_time_(int t)
the processing time required for a full process
This Facility is intended to convert a resource from one commodity to another.
void out_commod_(std::string c)
the out commodity
void max_inv_size_(double c)
the maximum amount allowed in inventory