Skip to content

Commit

Permalink
test custom seed
Browse files Browse the repository at this point in the history
  • Loading branch information
nuclearkatie committed Dec 12, 2023
1 parent 298ea7c commit acc08c5
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
59 changes: 59 additions & 0 deletions tests/input/custom_seed.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<simulation>
<control>
<duration>1</duration>
<startmonth>1</startmonth>
<startyear>2000</startyear>
<seed>20240101</seed>
<stride>1234</stride>
</control>

<archetypes>
<spec><lib>agents</lib><name>Source</name></spec>
<spec><lib>agents</lib><name>Sink</name></spec>
<spec><lib>agents</lib><name>NullRegion</name></spec>
<spec><lib>agents</lib><name>NullInst</name></spec>
</archetypes>

<facility>
<name>src</name>
<lifetime>1</lifetime>
<config>
<Source>
<commod>commod</commod>
<capacity>1</capacity>
</Source>
</config>
</facility>

<facility>
<name>snk</name>
<config>
<Sink>
<in_commods><val>commod</val></in_commods>
<recipe_name>commod_recipe</recipe_name>
<capacity>1</capacity>
</Sink>
</config>
</facility>

<region>
<name>SingleRegion</name>
<config> <NullRegion/> </config>
<institution>
<name>SingleInstitution</name>
<initialfacilitylist>
<entry> <prototype>src</prototype> <number>1</number> </entry>
<entry> <prototype>snk</prototype> <number>1</number> </entry>
</initialfacilitylist>
<config> <NullInst/> </config>
</institution>
</region>

<recipe>
<name>commod_recipe</name>
<basis>mass</basis>
<nuclide> <id>cs137</id> <comp>1</comp> </nuclide>
</recipe>

</simulation>

9 changes: 9 additions & 0 deletions tests/integ_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ void RunSim(std::string infile, SqliteBack* back) {
TEST(IntegTests, RunAllInfiles) {
std::vector<std::string> infiles;
infiles.push_back("custom_dt.xml");
infiles.push_back("custom_seed.xml");
infiles.push_back("inventory.xml");
infiles.push_back("inventory_compact.xml");
infiles.push_back("inventory_compact_false.xml");
Expand Down Expand Up @@ -106,4 +107,12 @@ TEST(IntegTests, CustomTimestepDurFlat) {
}
}

TEST(IntegTests, CustomSeed) {
SqliteBack back(":memory:");
RunSim("custom_seed.xml", &back);
QueryResult qr = back.Query("Info", NULL);
EXPECT_EQ(20240101, qr.GetVal<int>("Seed"));
EXPECT_EQ(1234, qr.GetVal<int>("Stride"));
}

} // namespace cyclus

0 comments on commit acc08c5

Please sign in to comment.