From 24f3587b34cf60adad8a3d14e8cc63c20c2b0be5 Mon Sep 17 00:00:00 2001 From: Wim Haeck Date: Fri, 21 Aug 2020 17:33:38 -0600 Subject: [PATCH 1/2] Capture is no longer a special reaction but the 'capture' string is still a valid ParticlePairID --- src/elementary/ParticlePairID/src/validate.hpp | 4 ++-- src/elementary/ParticlePairID/test/ParticlePairID.test.cpp | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/elementary/ParticlePairID/src/validate.hpp b/src/elementary/ParticlePairID/src/validate.hpp index fd00bb1..dd52f1d 100644 --- a/src/elementary/ParticlePairID/src/validate.hpp +++ b/src/elementary/ParticlePairID/src/validate.hpp @@ -11,8 +11,8 @@ static bool validate( const std::string& string ) { if ( ReactionType::isRegistered( string ) ) { ReactionType type( string ); - if ( ( not type.particles().size() ) and - ( type != ReactionType( "elastic" ) ) ) { + if ( ( type.isSpecial() or ( type.name() == "capture" ) ) and + ( type.name() != "elastic" ) ) { return true; } diff --git a/src/elementary/ParticlePairID/test/ParticlePairID.test.cpp b/src/elementary/ParticlePairID/test/ParticlePairID.test.cpp index f3e8b5f..cc3130a 100644 --- a/src/elementary/ParticlePairID/test/ParticlePairID.test.cpp +++ b/src/elementary/ParticlePairID/test/ParticlePairID.test.cpp @@ -27,6 +27,9 @@ SCENARIO( "ParticlePairID" ) { // using a string - from a registered reaction type ParticlePairID id3( "total" ); CHECK( "total" == id3.symbol() ); + + id3 = ParticlePairID( "capture" ); + CHECK( "capture" == id3.symbol() ); } // THEN } // GIVEN From 87278b00120bcaab7855814dfa51f87e7415992d Mon Sep 17 00:00:00 2001 From: Wim Haeck Date: Fri, 21 Aug 2020 18:11:42 -0600 Subject: [PATCH 2/2] Made sure capture is a valid string for a ParticleTupleID, added tests --- src/elementary/ParticleTupleID/src/validate.hpp | 4 ++-- src/elementary/ParticleTupleID/test/ParticleTupleID.test.cpp | 3 +++ src/elementary/ReactionID/test/ReactionID.test.cpp | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/elementary/ParticleTupleID/src/validate.hpp b/src/elementary/ParticleTupleID/src/validate.hpp index 675070f..52f4461 100644 --- a/src/elementary/ParticleTupleID/src/validate.hpp +++ b/src/elementary/ParticleTupleID/src/validate.hpp @@ -11,8 +11,8 @@ static bool validate( const std::string& string ) { if ( ReactionType::isRegistered( string ) ) { ReactionType type( string ); - if ( ( not type.particles().size() ) and - ( type != ReactionType( "elastic" ) ) ) { + if ( ( type.isSpecial() or ( type.name() == "capture" ) ) and + ( type.name() != "elastic" ) ) { return true; } diff --git a/src/elementary/ParticleTupleID/test/ParticleTupleID.test.cpp b/src/elementary/ParticleTupleID/test/ParticleTupleID.test.cpp index 554caaf..afaa9bf 100644 --- a/src/elementary/ParticleTupleID/test/ParticleTupleID.test.cpp +++ b/src/elementary/ParticleTupleID/test/ParticleTupleID.test.cpp @@ -44,6 +44,9 @@ SCENARIO( "ParticleTupleID" ) { ParticleTupleID id6( "total" ); CHECK( "total" == id6.symbol() ); + id6 = ParticleTupleID( "capture" ); + CHECK( "capture" == id6.symbol() ); + // using a particle pair ParticleTupleID id7( ParticlePairID( ParticleID( "n" ), ParticleID( "Fe56" ) ) ); diff --git a/src/elementary/ReactionID/test/ReactionID.test.cpp b/src/elementary/ReactionID/test/ReactionID.test.cpp index 6158d10..d2a0b70 100644 --- a/src/elementary/ReactionID/test/ReactionID.test.cpp +++ b/src/elementary/ReactionID/test/ReactionID.test.cpp @@ -32,6 +32,9 @@ SCENARIO( "ParticlePairID" ) { ReactionID id3( "n,Fe56->n,Fe56" ); CHECK( "n,Fe56->n,Fe56" == id3.symbol() ); + id3 = ReactionID( "n,Fe56->capture" ); + CHECK( "n,Fe56->capture" == id3.symbol() ); + // using a reaction type ReactionID id4( ParticleID( "n" ), ParticleID( "Fe56" ), ReactionType( "elastic" ) ); CHECK( "n,Fe56->n,Fe56" == id4.symbol() );