Skip to content

Commit

Permalink
add something that decays faster for Decay tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gonuke committed Oct 28, 2024
1 parent 2d48ba7 commit 0cdb338
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 6 additions & 1 deletion tests/material_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,13 @@ TEST_F(MaterialTest, DecayResBuf) {
double u235_qty = orig.mass(u235_);
double pb208_qty = orig.mass(pb208_);
double am241_qty = orig.mass(am241_);
double sr89_qty = orig.mass(sr89_);
double orig_mass = tracked_mat_->quantity();

cyclus::toolkit::ResBuf<cyclus::Material> res_buf;
res_buf.Push(tracked_mat_);
res_buf.Decay(100);
// decay for 2 months which is just over 1 Sr-89 half-life
res_buf.Decay(2);
cyclus::Material::Ptr pop_mat = res_buf.Pop();

// postquery
Expand All @@ -229,6 +231,7 @@ TEST_F(MaterialTest, DecayResBuf) {
EXPECT_NE(u235_qty, mq.mass(u235_));
EXPECT_NE(pb208_qty, mq.mass(pb208_));
EXPECT_NE(am241_qty, mq.mass(am241_));
EXPECT_NE(sr89_qty, mq.mass(sr89_));
}

TEST_F(MaterialTest, DecayManual) {
Expand All @@ -237,6 +240,7 @@ TEST_F(MaterialTest, DecayManual) {
double u235_qty = orig.mass(u235_);
double pb208_qty = orig.mass(pb208_);
double am241_qty = orig.mass(am241_);
double sr89_qty = orig.mass(sr89_);
double orig_mass = tracked_mat_->quantity();

tracked_mat_->Decay(100);
Expand All @@ -248,6 +252,7 @@ TEST_F(MaterialTest, DecayManual) {
EXPECT_NE(u235_qty, mq.mass(u235_));
EXPECT_NE(pb208_qty, mq.mass(pb208_));
EXPECT_NE(am241_qty, mq.mass(am241_));
EXPECT_NE(sr89_qty, mq.mass(sr89_));
}

TEST_F(MaterialTest, DecayLazy) {
Expand Down
4 changes: 3 additions & 1 deletion tests/material_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace cyclus {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
class MaterialTest : public ::testing::Test {
protected:
Nuc u235_, am241_, th228_, pb208_, pu239_;
Nuc u235_, am241_, th228_, pb208_, pu239_, sr89_;
int one_g_; // grams
Composition::Ptr test_comp_, diff_comp_;
double test_size_, fraction;
Expand Down Expand Up @@ -56,6 +56,7 @@ class MaterialTest : public ::testing::Test {
am241_ = 952410000;
th228_ = 902280000;
pb208_ = 822080000;
sr89_ = 380890000;
test_size_ = 10 * units::g;
fraction = 2.0 / 3.0;

Expand All @@ -67,6 +68,7 @@ class MaterialTest : public ::testing::Test {
v[u235_] = 1;
v[pb208_] = 1;
v[am241_] = 1;
v[sr89_] = 1;
diff_comp_ = Composition::CreateFromMass(v);

default_mat_ = Material::CreateUntracked(0 * units::g, test_comp_);
Expand Down

0 comments on commit 0cdb338

Please sign in to comment.