Skip to content

Commit

Permalink
expanded tests - bulk buffer not working
Browse files Browse the repository at this point in the history
  • Loading branch information
gonuke committed Mar 10, 2024
1 parent 35df00e commit ec720df
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
27 changes: 27 additions & 0 deletions tests/toolkit/res_buf_tests.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "res_buf_tests.h"
#include "toolkit/mat_query.h"

#include <gtest/gtest.h>

Expand Down Expand Up @@ -368,7 +369,33 @@ TEST_F(MaterialBufTest, NonBulkTest) {
ASSERT_EQ(mat_store_.space(), space_exp);
ASSERT_EQ(mat_store_.quantity(), qty_exp);

Material::Ptr pop1_ = mat_store_.Pop();
ASSERT_EQ(pop1_->comp(), test_comp1_);
Material::Ptr pop2_ = mat_store_.Pop();
ASSERT_EQ(pop2_->comp(), test_comp2_);

}

TEST_F(MaterialBufTest, BulkTest) {

ASSERT_EQ(bulk_store_.count(), 1);
ASSERT_EQ(bulk_store_.capacity(), cap_);
double qty_exp = 2 * mat1_->quantity();
double space_exp = cap_ - qty_exp;
ASSERT_EQ(bulk_store_.space(), space_exp);
ASSERT_EQ(bulk_store_.quantity(), qty_exp);

Material::Ptr pop1_ = mat_store_.Pop();
cyclus::toolkit::MatQuery mq1(pop1_);
double sr89_qty = mq1.mass(sr89_);
double fe59_qty = mq1.mass(fe59_);

ASSERT_EQ(sr89_qty, 5.0 * units::g);
ASSERT_EQ(fe59_qty, 5.0 * units::g);


}


} // namespace toolkit
} // namespace cyclus
5 changes: 4 additions & 1 deletion tests/toolkit/res_buf_tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class MaterialBufTest : public ::testing::Test {

Nuc sr89_, fe59_;
Material::Ptr mat1_, mat2_, mat3_;
Composition::Ptr test_comp1_, test_comp2_;
Composition::Ptr test_comp1_, test_comp2_, test_comp3_;

double cap_;

Expand All @@ -90,6 +90,9 @@ class MaterialBufTest : public ::testing::Test {
w[fe59_] = 2;
test_comp2_ = Composition::CreateFromMass(w);

w[sr89_] = 1;
test_comp3_ = Composition::CreateFromMass(w);

mat1_ = Material::CreateUntracked(5 * units::g, test_comp1_);
mat2_ = Material::CreateUntracked(5 * units::g, test_comp2_);
mat3_ = Material::CreateUntracked(5 * units::g, test_comp1_);
Expand Down

0 comments on commit ec720df

Please sign in to comment.