Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-12 08:27:21

0001 #include <cassert>
0002 #include <cstring>
0003 
0004 #include "OpticksGenstep.h"
0005 
0006 void test_retired_codes()
0007 {
0008     for (unsigned type = 1; type <= 5; ++type)
0009     {
0010         assert(std::strcmp(OpticksGenstep_::Name(type), OpticksGenstep_::INVALID_) == 0);
0011         assert(!OpticksGenstep_::IsValid(type));
0012         assert(!OpticksGenstep_::IsCerenkov(type));
0013         assert(!OpticksGenstep_::IsScintillation(type));
0014         assert(!OpticksGenstep_::IsExpected(type));
0015         assert(OpticksGenstep_::GenstepToPhotonFlag(type) == NAN_ABORT);
0016     }
0017 }
0018 
0019 void test_current_optical_codes()
0020 {
0021     static_assert(OpticksGenstep_TORCH == 6, "genstep protocol values must remain stable");
0022     static_assert(OpticksGenstep_CERENKOV == 15, "genstep protocol values must remain stable");
0023     static_assert(OpticksGenstep_SCINTILLATION == 16, "genstep protocol values must remain stable");
0024 
0025     assert(OpticksGenstep_::Type("CERENKOV") == OpticksGenstep_CERENKOV);
0026     assert(OpticksGenstep_::Type("SCINTILLATION") == OpticksGenstep_SCINTILLATION);
0027     assert(OpticksGenstep_::IsCerenkov(OpticksGenstep_CERENKOV));
0028     assert(OpticksGenstep_::IsCerenkov(OpticksGenstep_G4Cerenkov_modified));
0029     assert(OpticksGenstep_::IsScintillation(OpticksGenstep_SCINTILLATION));
0030     assert(OpticksGenstep_::GenstepToPhotonFlag(OpticksGenstep_CERENKOV) == CERENKOV);
0031     assert(OpticksGenstep_::GenstepToPhotonFlag(OpticksGenstep_SCINTILLATION) == SCINTILLATION);
0032 }
0033 
0034 int main()
0035 {
0036     test_retired_codes();
0037     test_current_optical_codes();
0038     return 0;
0039 }