Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ec720df

Browse files
committedMar 10, 2024·
expanded tests - bulk buffer not working
1 parent 35df00e commit ec720df

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed
 

‎tests/toolkit/res_buf_tests.cc

+27
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "res_buf_tests.h"
2+
#include "toolkit/mat_query.h"
23

34
#include <gtest/gtest.h>
45

@@ -368,7 +369,33 @@ TEST_F(MaterialBufTest, NonBulkTest) {
368369
ASSERT_EQ(mat_store_.space(), space_exp);
369370
ASSERT_EQ(mat_store_.quantity(), qty_exp);
370371

372+
Material::Ptr pop1_ = mat_store_.Pop();
373+
ASSERT_EQ(pop1_->comp(), test_comp1_);
374+
Material::Ptr pop2_ = mat_store_.Pop();
375+
ASSERT_EQ(pop2_->comp(), test_comp2_);
376+
371377
}
372378

379+
TEST_F(MaterialBufTest, BulkTest) {
380+
381+
ASSERT_EQ(bulk_store_.count(), 1);
382+
ASSERT_EQ(bulk_store_.capacity(), cap_);
383+
double qty_exp = 2 * mat1_->quantity();
384+
double space_exp = cap_ - qty_exp;
385+
ASSERT_EQ(bulk_store_.space(), space_exp);
386+
ASSERT_EQ(bulk_store_.quantity(), qty_exp);
387+
388+
Material::Ptr pop1_ = mat_store_.Pop();
389+
cyclus::toolkit::MatQuery mq1(pop1_);
390+
double sr89_qty = mq1.mass(sr89_);
391+
double fe59_qty = mq1.mass(fe59_);
392+
393+
ASSERT_EQ(sr89_qty, 5.0 * units::g);
394+
ASSERT_EQ(fe59_qty, 5.0 * units::g);
395+
396+
397+
}
398+
399+
373400
} // namespace toolkit
374401
} // namespace cyclus

‎tests/toolkit/res_buf_tests.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class MaterialBufTest : public ::testing::Test {
7373

7474
Nuc sr89_, fe59_;
7575
Material::Ptr mat1_, mat2_, mat3_;
76-
Composition::Ptr test_comp1_, test_comp2_;
76+
Composition::Ptr test_comp1_, test_comp2_, test_comp3_;
7777

7878
double cap_;
7979

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

93+
w[sr89_] = 1;
94+
test_comp3_ = Composition::CreateFromMass(w);
95+
9396
mat1_ = Material::CreateUntracked(5 * units::g, test_comp1_);
9497
mat2_ = Material::CreateUntracked(5 * units::g, test_comp2_);
9598
mat3_ = Material::CreateUntracked(5 * units::g, test_comp1_);

0 commit comments

Comments
 (0)
Please sign in to comment.