Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:16

0001 
0002 #include <vector>
0003 #include <csignal>
0004 #include <algorithm>
0005 #include "SEnabled.hh"
0006 #include "OPTICKS_LOG.hh"
0007 
0008 
0009 template<unsigned N>
0010 void test_isEnabled(const char* spec, const std::vector<unsigned>& e)
0011 {
0012     SEnabled<N>* idx = new SEnabled<N>(spec);  
0013     for(unsigned i=0 ; i < N ; i++)
0014     {
0015         bool expect = std::find(e.begin(), e.end(), i) != e.end() ; 
0016         bool enabled = idx->isEnabled(i) ; 
0017         bool enabled_expect = expect == enabled ;
0018         assert(enabled_expect);
0019         if(!enabled_expect) std::raise(SIGINT);   
0020     }
0021 }
0022 
0023 int main(int argc, char** argv)
0024 {
0025     OPTICKS_LOG(argc, argv); 
0026 
0027     test_isEnabled<16>("10,5,11", {10,5,11} ); 
0028     test_isEnabled<16>("10,5,-1", {10,5,15} ); 
0029 
0030     test_isEnabled<1024>("1001,101,11,-1", {1001,101,11,1023} ); 
0031 
0032     return 0 ; 
0033 }