diff --git a/Stack/DummyStack/testDummyStack.cc b/Stack/DummyStack/testDummyStack.cc index 17952705507b87ccc1a4ece0e9fecb39a0656a4d..41a5731589d0909405f11de46188784eb9fa710b 100644 --- a/Stack/DummyStack/testDummyStack.cc +++ b/Stack/DummyStack/testDummyStack.cc @@ -25,7 +25,7 @@ TEST_CASE("DummyStack", "[stack]") { TestStack s; s.AddParticle(std::tuple<dummy::NoData>{noData}); - REQUIRE(s.GetSize() == 1); + CHECK(s.getEntries() == 1); } SECTION("stack fill and cleanup") { @@ -34,8 +34,8 @@ TEST_CASE("DummyStack", "[stack]") { // add 99 particles, each 10th particle is a nucleus with A=i and Z=A/2! for (int i = 0; i < 99; ++i) { s.AddParticle(std::tuple<dummy::NoData>{noData}); } - REQUIRE(s.GetSize() == 99); + CHECK(s.getEntries() == 99); for (int i = 0; i < 99; ++i) s.GetNextParticle().Delete(); - REQUIRE(s.GetSize() == 0); + CHECK(s.getEntries() == 0); } } diff --git a/Stack/NuclearStackExtension/testNuclearStackExtension.cc b/Stack/NuclearStackExtension/testNuclearStackExtension.cc index a29fe580924cf0584950f7bec2115ad248fbd695..372b6317262aff5508fe1830f456e7c26cac50f7 100644 --- a/Stack/NuclearStackExtension/testNuclearStackExtension.cc +++ b/Stack/NuclearStackExtension/testNuclearStackExtension.cc @@ -35,7 +35,7 @@ TEST_CASE("NuclearStackExtension", "[stack]") { particles::Code::Electron, 1.5_GeV, corsika::stack::MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s}); - REQUIRE(s.getEntries() == 1); + CHECK(s.getEntries() == 1); } SECTION("write nucleus") { @@ -48,12 +48,12 @@ TEST_CASE("NuclearStackExtension", "[stack]") { particles::Code::Nucleus, 1.5_GeV, corsika::stack::MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s, 10, 10}); - REQUIRE(s.getEntries() == 1); + CHECK(s.getEntries() == 1); } SECTION("write invalid nucleus") { ParticleDataStack s; - REQUIRE_THROWS( + CHECK_THROWS( s.AddParticle(std::tuple<particles::Code, units::si::HEPEnergyType, corsika::stack::MomentumVector, geometry::Point, units::si::TimeType, unsigned short, unsigned short>{ @@ -71,9 +71,9 @@ TEST_CASE("NuclearStackExtension", "[stack]") { corsika::stack::MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s}); const auto pout = s.GetNextParticle(); - REQUIRE(pout.GetPID() == particles::Code::Electron); - REQUIRE(pout.GetEnergy() == 1.5_GeV); - REQUIRE(pout.GetTime() == 100_s); + CHECK(pout.GetPID() == particles::Code::Electron); + CHECK(pout.GetEnergy() == 1.5_GeV); + CHECK(pout.GetTime() == 100_s); } SECTION("read nucleus") { @@ -85,11 +85,11 @@ TEST_CASE("NuclearStackExtension", "[stack]") { corsika::stack::MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s, 10, 9}); const auto pout = s.GetNextParticle(); - REQUIRE(pout.GetPID() == particles::Code::Nucleus); - REQUIRE(pout.GetEnergy() == 1.5_GeV); - REQUIRE(pout.GetTime() == 100_s); - REQUIRE(pout.GetNuclearA() == 10); - REQUIRE(pout.GetNuclearZ() == 9); + CHECK(pout.GetPID() == particles::Code::Nucleus); + CHECK(pout.GetEnergy() == 1.5_GeV); + CHECK(pout.GetTime() == 100_s); + CHECK(pout.GetNuclearA() == 10); + CHECK(pout.GetNuclearZ() == 9); } SECTION("read invalid nucleus") { @@ -101,8 +101,8 @@ TEST_CASE("NuclearStackExtension", "[stack]") { corsika::stack::MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s}); const auto pout = s.GetNextParticle(); - REQUIRE_THROWS(pout.GetNuclearA()); - REQUIRE_THROWS(pout.GetNuclearZ()); + CHECK_THROWS(pout.GetNuclearA()); + CHECK_THROWS(pout.GetNuclearZ()); } SECTION("stack fill and cleanup") { @@ -127,9 +127,9 @@ TEST_CASE("NuclearStackExtension", "[stack]") { } } - REQUIRE(s.getEntries() == 99); + CHECK(s.getEntries() == 99); for (int i = 0; i < 99; ++i) s.GetNextParticle().Delete(); - REQUIRE(s.getEntries() == 0); + CHECK(s.getEntries() == 0); } SECTION("stack operations") { @@ -160,17 +160,17 @@ TEST_CASE("NuclearStackExtension", "[stack]") { const auto& p9 = s.cbegin() + 9; const auto& p10 = s.cbegin() + 10; - REQUIRE(p9.GetPID() == particles::Code::Nucleus); - REQUIRE(p9.GetEnergy() == 9 * 15_GeV); - REQUIRE(p9.GetTime() == 100_s); - REQUIRE(p9.GetNuclearA() == 9); - REQUIRE(p9.GetNuclearZ() == 9 / 2); - - REQUIRE(p10.GetPID() == particles::Code::Nucleus); - REQUIRE(p10.GetEnergy() == 9 * 15_GeV); - REQUIRE(p10.GetTime() == 100_s); - REQUIRE(p10.GetNuclearA() == 9); - REQUIRE(p10.GetNuclearZ() == 9 / 2); + CHECK(p9.GetPID() == particles::Code::Nucleus); + CHECK(p9.GetEnergy() == 9 * 15_GeV); + CHECK(p9.GetTime() == 100_s); + CHECK(p9.GetNuclearA() == 9); + CHECK(p9.GetNuclearZ() == 9 / 2); + + CHECK(p10.GetPID() == particles::Code::Nucleus); + CHECK(p10.GetEnergy() == 9 * 15_GeV); + CHECK(p10.GetTime() == 100_s); + CHECK(p10.GetNuclearA() == 9); + CHECK(p10.GetNuclearZ() == 9 / 2); } // copy @@ -179,13 +179,13 @@ TEST_CASE("NuclearStackExtension", "[stack]") { const auto& p93 = s.cbegin() + 93; const auto& p9 = s.cbegin() + 9; - REQUIRE(p9.GetPID() == particles::Code::Electron); - REQUIRE(p9.GetEnergy() == 93 * 1.5_GeV); - REQUIRE(p9.GetTime() == 100_s); + CHECK(p9.GetPID() == particles::Code::Electron); + CHECK(p9.GetEnergy() == 93 * 1.5_GeV); + CHECK(p9.GetTime() == 100_s); - REQUIRE(p93.GetPID() == particles::Code::Electron); - REQUIRE(p93.GetEnergy() == 93 * 1.5_GeV); - REQUIRE(p93.GetTime() == 100_s); + CHECK(p93.GetPID() == particles::Code::Electron); + CHECK(p93.GetEnergy() == 93 * 1.5_GeV); + CHECK(p93.GetTime() == 100_s); } // swap @@ -194,15 +194,15 @@ TEST_CASE("NuclearStackExtension", "[stack]") { const auto& p11 = s.cbegin() + 11; // now: nucleus const auto& p10 = s.cbegin() + 10; // now: electron - REQUIRE(p11.GetPID() == particles::Code::Nucleus); - REQUIRE(p11.GetEnergy() == 9 * 15_GeV); - REQUIRE(p11.GetTime() == 100_s); - REQUIRE(p11.GetNuclearA() == 9); - REQUIRE(p11.GetNuclearZ() == 9 / 2); + CHECK(p11.GetPID() == particles::Code::Nucleus); + CHECK(p11.GetEnergy() == 9 * 15_GeV); + CHECK(p11.GetTime() == 100_s); + CHECK(p11.GetNuclearA() == 9); + CHECK(p11.GetNuclearZ() == 9 / 2); - REQUIRE(p10.GetPID() == particles::Code::Electron); - REQUIRE(p10.GetEnergy() == 11 * 1.5_GeV); - REQUIRE(p10.GetTime() == 100_s); + CHECK(p10.GetPID() == particles::Code::Electron); + CHECK(p10.GetEnergy() == 11 * 1.5_GeV); + CHECK(p10.GetTime() == 100_s); } // swap two nuclei @@ -211,20 +211,20 @@ TEST_CASE("NuclearStackExtension", "[stack]") { const auto& p29 = s.cbegin() + 29; const auto& p59 = s.cbegin() + 59; - REQUIRE(p29.GetPID() == particles::Code::Nucleus); - REQUIRE(p29.GetEnergy() == 59 * 15_GeV); - REQUIRE(p29.GetTime() == 100_s); - REQUIRE(p29.GetNuclearA() == 59); - REQUIRE(p29.GetNuclearZ() == 59 / 2); - - REQUIRE(p59.GetPID() == particles::Code::Nucleus); - REQUIRE(p59.GetEnergy() == 29 * 15_GeV); - REQUIRE(p59.GetTime() == 100_s); - REQUIRE(p59.GetNuclearA() == 29); - REQUIRE(p59.GetNuclearZ() == 29 / 2); + CHECK(p29.GetPID() == particles::Code::Nucleus); + CHECK(p29.GetEnergy() == 59 * 15_GeV); + CHECK(p29.GetTime() == 100_s); + CHECK(p29.GetNuclearA() == 59); + CHECK(p29.GetNuclearZ() == 59 / 2); + + CHECK(p59.GetPID() == particles::Code::Nucleus); + CHECK(p59.GetEnergy() == 29 * 15_GeV); + CHECK(p59.GetTime() == 100_s); + CHECK(p59.GetNuclearA() == 29); + CHECK(p59.GetNuclearZ() == 29 / 2); } for (int i = 0; i < 99; ++i) s.last().Delete(); - REQUIRE(s.getEntries() == 0); + CHECK(s.getEntries() == 0); } } diff --git a/Stack/SuperStupidStack/testSuperStupidStack.cc b/Stack/SuperStupidStack/testSuperStupidStack.cc index 5f50a153f74d68520eced3640f6302433f40a69c..474df8d012474094599de63f72480a1affd5491a 100644 --- a/Stack/SuperStupidStack/testSuperStupidStack.cc +++ b/Stack/SuperStupidStack/testSuperStupidStack.cc @@ -20,7 +20,6 @@ using namespace corsika::units::si; using namespace corsika; using namespace corsika::stack::super_stupid; -#include <iostream> using namespace std; TEST_CASE("SuperStupidStack", "[stack]") { @@ -31,9 +30,7 @@ TEST_CASE("SuperStupidStack", "[stack]") { SECTION("read+write") { SuperStupidStack s; - s.AddParticle(std::tuple<corsika::particles::Code, corsika::units::si::HEPEnergyType, - corsika::stack::MomentumVector, corsika::geometry::Point, - corsika::units::si::TimeType>{ + s.AddParticle(std::make_tuple{ particles::Code::Electron, 1.5_GeV, corsika::stack::MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s}); @@ -44,9 +41,6 @@ TEST_CASE("SuperStupidStack", "[stack]") { auto pout = s.GetNextParticle(); CHECK(pout.GetPID() == particles::Code::Electron); CHECK(pout.GetEnergy() == 1.5_GeV); - // CHECK(pout.GetMomentum() == stack::MomentumVector(dummyCS, {1_GeV, - // 1_GeV, 1_GeV})); CHECK(pout.GetPosition() == Point(dummyCS, {1 * meter, 1 * - // meter, 1 * meter})); CHECK(pout.GetTime() == 100_s); } @@ -55,9 +49,7 @@ TEST_CASE("SuperStupidStack", "[stack]") { SuperStupidStack s; for (int i = 0; i < 99; ++i) s.AddParticle( - std::tuple<corsika::particles::Code, corsika::units::si::HEPEnergyType, - corsika::stack::MomentumVector, corsika::geometry::Point, - corsika::units::si::TimeType>{ + std::make_tuple{ particles::Code::Electron, 1.5_GeV, corsika::stack::MomentumVector(dummyCS, {1_GeV, 1_GeV, 1_GeV}), Point(dummyCS, {1 * meter, 1 * meter, 1 * meter}), 100_s});