9 #include <boost/test/unit_test.hpp>
29 BOOST_AUTO_TEST_SUITE(MaterialAccumulatedMaterialSlab)
32 AccumulatedMaterialSlab a;
33 auto [average, trackCount] = a.totalAverage();
35 BOOST_CHECK(not(average));
36 BOOST_CHECK_EQUAL(trackCount, 0
u);
41 AccumulatedMaterialSlab a;
45 auto [average, trackCount] = a.totalAverage();
46 BOOST_CHECK(not(average));
47 BOOST_CHECK_EQUAL(trackCount, 0
u);
52 AccumulatedMaterialSlab a;
56 auto [average, trackCount] = a.totalAverage();
57 BOOST_CHECK(not(average));
58 BOOST_CHECK_EQUAL(trackCount, 3
u);
63 AccumulatedMaterialSlab a;
70 auto [average, trackCount] = a.totalAverage();
71 BOOST_CHECK_EQUAL(trackCount, 1
u);
72 BOOST_CHECK_EQUAL(average.material(), unit.material());
73 BOOST_CHECK_EQUAL(average.thickness(), 3 * unit.thickness());
74 BOOST_CHECK_EQUAL(average.thicknessInX0(), 3.0f);
75 BOOST_CHECK_EQUAL(average.thicknessInL0(), 3.0f);
83 auto [average, trackCount] = a.totalAverage();
84 BOOST_CHECK_EQUAL(trackCount, 2
u);
86 BOOST_CHECK_EQUAL(average.material(), unit.material());
87 BOOST_CHECK_EQUAL(average.thickness(), 3 * unit.thickness());
88 BOOST_CHECK_EQUAL(average.thicknessInX0(), 3.0f);
89 BOOST_CHECK_EQUAL(average.thicknessInL0(), 3.0f);
97 AccumulatedMaterialSlab a;
104 auto [average, trackCount] = a.totalAverage();
105 BOOST_CHECK_EQUAL(trackCount, 1
u);
106 BOOST_CHECK_EQUAL(average.material(), unit.material());
107 BOOST_CHECK_EQUAL(average.thickness(), 3 * unit.thickness());
108 BOOST_CHECK_EQUAL(average.thicknessInX0(), 3.0f);
109 BOOST_CHECK_EQUAL(average.thicknessInL0(), 3.0f);
113 MaterialSlab twice = unit;
114 twice.scaleThickness(2);
118 auto [average, trackCount] = a.totalAverage();
119 BOOST_CHECK_EQUAL(trackCount, 2
u);
121 BOOST_CHECK_EQUAL(average.material(), unit.material());
122 BOOST_CHECK_EQUAL(average.thickness(), 3 * unit.thickness());
123 BOOST_CHECK_EQUAL(average.thicknessInX0(), 3.0f);
124 BOOST_CHECK_EQUAL(average.thicknessInL0(), 3.0f);
128 MaterialSlab thrice = unit;
129 thrice.scaleThickness(3);
130 a.accumulate(thrice);
132 auto [average, trackCount] = a.totalAverage();
133 BOOST_CHECK_EQUAL(trackCount, 3
u);
135 BOOST_CHECK_EQUAL(average.material(), unit.material());
136 BOOST_CHECK_EQUAL(average.thickness(), 3 * unit.thickness());
137 BOOST_CHECK_EQUAL(average.thicknessInX0(), 3.0f);
138 BOOST_CHECK_EQUAL(average.thicknessInL0(), 3.0f);
145 AccumulatedMaterialSlab a;
150 auto [average, trackCount] = a.totalAverage();
151 BOOST_CHECK_EQUAL(trackCount, 1
u);
152 BOOST_CHECK_EQUAL(average.material(), unit.material());
153 BOOST_CHECK_EQUAL(average.thickness(), unit.thickness());
154 BOOST_CHECK_EQUAL(average.thicknessInX0(), unit.thicknessInX0());
155 BOOST_CHECK_EQUAL(average.thicknessInL0(), unit.thicknessInL0());
159 MaterialSlab
three = unit;
160 three.scaleThickness(3);
163 auto [average, trackCount] = a.totalAverage();
164 BOOST_CHECK_EQUAL(trackCount, 2);
166 BOOST_CHECK_EQUAL(average.material(), unit.material());
167 BOOST_CHECK_EQUAL(average.thickness(), 2 * unit.thickness());
168 BOOST_CHECK_EQUAL(average.thicknessInX0(), 2 * unit.thicknessInX0());
169 BOOST_CHECK_EQUAL(average.thicknessInL0(), 2 * unit.thicknessInL0());
173 MaterialSlab vac(2 * unit.thickness());
179 auto [average, trackCount] = a.totalAverage();
180 BOOST_CHECK_EQUAL(trackCount, 4
u);
185 0.5f * unit.material().molarDensity(),
eps);
190 BOOST_CHECK_EQUAL(average.thicknessInX0(), 1 * unit.thicknessInX0());
191 BOOST_CHECK_EQUAL(average.thicknessInL0(), 1 * unit.thicknessInL0());
193 BOOST_CHECK_EQUAL(average.thickness(), 2 * unit.thickness());
197 BOOST_AUTO_TEST_SUITE_END()