9 #include <boost/test/unit_test.hpp>
24 constexpr
auto eps = std::numeric_limits<float>::epsilon();
36 BOOST_AUTO_TEST_SUITE(AverageMaterials)
44 BOOST_CHECK(not slab.material());
45 BOOST_CHECK_EQUAL(slab.thickness(), 0.0f);
46 BOOST_CHECK_EQUAL(slab.thicknessInX0(), 0.0f);
47 BOOST_CHECK_EQUAL(slab.thicknessInL0(), 0.0f);
52 BOOST_CHECK(not slab.material());
53 BOOST_CHECK_EQUAL(slab.thickness(), 2.0f);
54 BOOST_CHECK_EQUAL(slab.thicknessInX0(), 0.0f);
55 BOOST_CHECK_EQUAL(slab.thicknessInL0(), 0.0f);
62 BOOST_CHECK(slab.material());
63 BOOST_CHECK_EQUAL(slab.material(), percent);
65 BOOST_CHECK_EQUAL(slab.thickness(), 2 * percent.thickness());
66 BOOST_CHECK_EQUAL(slab.thicknessInX0(), 2 * percent.thicknessInX0());
67 BOOST_CHECK_EQUAL(slab.thicknessInL0(), 2 * percent.thicknessInL0());
73 BOOST_CHECK(slab.material());
74 BOOST_CHECK_EQUAL(slab.material(), unit);
76 BOOST_CHECK_EQUAL(slab.thickness(), 2 * unit.thickness());
77 BOOST_CHECK_EQUAL(slab.thicknessInX0(), 2 * unit.thicknessInX0());
78 BOOST_CHECK_EQUAL(slab.thicknessInL0(), 2 * unit.thicknessInL0());
86 BOOST_CHECK(slab.material());
87 BOOST_CHECK_EQUAL(slab.material(), percent);
88 BOOST_CHECK_EQUAL(slab.thickness(), percent.thickness());
89 BOOST_CHECK_EQUAL(slab.thicknessInX0(), percent.thicknessInX0());
90 BOOST_CHECK_EQUAL(slab.thicknessInL0(), percent.thicknessInL0());
95 BOOST_CHECK(slab.material());
96 BOOST_CHECK_EQUAL(slab.material(), percent);
97 BOOST_CHECK_EQUAL(slab.thickness(), percent.thickness());
98 BOOST_CHECK_EQUAL(slab.thicknessInX0(), percent.thicknessInX0());
99 BOOST_CHECK_EQUAL(slab.thicknessInL0(), percent.thicknessInL0());
106 BOOST_CHECK(slab.material());
107 BOOST_CHECK_EQUAL(slab.material(), unit);
108 BOOST_CHECK_EQUAL(slab.thickness(), unit.thickness());
109 BOOST_CHECK_EQUAL(slab.thicknessInX0(), unit.thicknessInX0());
110 BOOST_CHECK_EQUAL(slab.thicknessInL0(), unit.thicknessInL0());
115 BOOST_CHECK(slab.material());
116 BOOST_CHECK_EQUAL(slab.material(), unit);
117 BOOST_CHECK_EQUAL(slab.thickness(), unit.thickness());
118 BOOST_CHECK_EQUAL(slab.thicknessInX0(), unit.thicknessInX0());
119 BOOST_CHECK_EQUAL(slab.thicknessInL0(), unit.thicknessInL0());
129 BOOST_CHECK(slab.material());
130 BOOST_CHECK_EQUAL(slab.material(), percent);
131 BOOST_CHECK_EQUAL(slab.thickness(), percent.thickness() + unit.thickness());
132 BOOST_CHECK_EQUAL(slab.thicknessInX0(),
133 percent.thicknessInX0() + unit.thicknessInX0());
134 BOOST_CHECK_EQUAL(slab.thicknessInL0(),
135 percent.thicknessInL0() + unit.thicknessInL0());
140 BOOST_CHECK(slab.material());
141 BOOST_CHECK_EQUAL(slab.material(), unit);
142 BOOST_CHECK_EQUAL(slab.thickness(), unit.thickness() + percent.thickness());
143 BOOST_CHECK_EQUAL(slab.thicknessInX0(),
144 percent.thicknessInX0() + unit.thicknessInX0());
145 BOOST_CHECK_EQUAL(slab.thicknessInL0(),
146 percent.thicknessInL0() + unit.thicknessInL0());
156 BOOST_CHECK(slab.material());
157 BOOST_CHECK_EQUAL(slab.material(), unit);
158 BOOST_CHECK_EQUAL(slab.thickness(), unit.thickness());
159 BOOST_CHECK_EQUAL(slab.thicknessInX0(), unit.thicknessInX0());
160 BOOST_CHECK_EQUAL(slab.thicknessInL0(), unit.thicknessInL0());
165 BOOST_CHECK(slab.material());
166 BOOST_CHECK_EQUAL(slab.material(), unit);
167 BOOST_CHECK_EQUAL(slab.thickness(), unit.thickness());
168 BOOST_CHECK_EQUAL(slab.thicknessInX0(), unit.thicknessInX0());
169 BOOST_CHECK_EQUAL(slab.thicknessInL0(), unit.thicknessInL0());
181 BOOST_CHECK_EQUAL(slab.thickness(), 2.0f);
182 BOOST_CHECK_EQUAL(slab.thicknessInX0(), slabMat.thicknessInX0());
183 BOOST_CHECK_EQUAL(slab.thicknessInL0(), slabMat.thicknessInL0());
184 BOOST_CHECK(slab.material());
187 BOOST_CHECK_EQUAL(slab.material().Ar(), mat.Ar());
188 BOOST_CHECK_EQUAL(slab.material().Z(), 0.5 * mat.Z());
193 BOOST_CHECK_EQUAL(slab.material().molarDensity(),
194 0.5f * mat.molarDensity());
199 BOOST_CHECK(slab.material());
200 BOOST_CHECK_EQUAL(slab.thickness(), 2.0f);
201 BOOST_CHECK_EQUAL(slab.thicknessInX0(), slabMat.thicknessInX0());
202 BOOST_CHECK_EQUAL(slab.thicknessInL0(), slabMat.thicknessInL0());
205 BOOST_CHECK_EQUAL(slab.material().Ar(), mat.Ar());
206 BOOST_CHECK_EQUAL(slab.material().Z(), 0.5 * mat.Z());
211 BOOST_CHECK_EQUAL(slab.material().molarDensity(),
212 0.5f * mat.molarDensity());
225 BOOST_CHECK_EQUAL(slabMat0.thickness(), 0.5f);
226 BOOST_CHECK_EQUAL(slabMat0.thicknessInX0(), 0.5f);
227 BOOST_CHECK_EQUAL(slabMat0.thicknessInL0(), 0.5f);
228 BOOST_CHECK_EQUAL(slabMat1.thickness(), 1.0f);
229 BOOST_CHECK_EQUAL(slabMat1.thicknessInX0(), 0.5f);
230 BOOST_CHECK_EQUAL(slabMat1.thicknessInL0(), 0.5f);
234 BOOST_CHECK(slab.material());
235 BOOST_CHECK_EQUAL(slab.thickness(), 1.5f);
236 BOOST_CHECK_EQUAL(slab.thicknessInX0(), 1.0f);
237 BOOST_CHECK_EQUAL(slab.thicknessInL0(), 1.0f);
238 BOOST_CHECK_EQUAL(slab.material().X0(), 1.5f);
239 BOOST_CHECK_EQUAL(slab.material().L0(), 1.5f);
240 BOOST_CHECK_EQUAL(slab.material().Ar(), 3.0f);
241 BOOST_CHECK_EQUAL(slab.material().Z(),
243 exp((0.5 / 1.5) * log(12.0) + (1.0 / 1.5) * log(6))));
244 BOOST_CHECK_EQUAL(slab.material().molarDensity(), 4.0f);
249 BOOST_CHECK(slab.material());
250 BOOST_CHECK_EQUAL(slab.thickness(), 1.5f);
251 BOOST_CHECK_EQUAL(slab.thicknessInX0(), 1.0f);
252 BOOST_CHECK_EQUAL(slab.thicknessInL0(), 1.0f);
253 BOOST_CHECK_EQUAL(slab.material().X0(), 1.5f);
254 BOOST_CHECK_EQUAL(slab.material().L0(), 1.5f);
255 BOOST_CHECK_EQUAL(slab.material().Ar(), 3.0f);
256 BOOST_CHECK_EQUAL(slab.material().Z(),
258 exp((0.5 / 1.5) * log(12.0) + (1.0 / 1.5) * log(6))));
259 BOOST_CHECK_EQUAL(slab.material().molarDensity(), 4.0f);
263 BOOST_AUTO_TEST_SUITE_END()