Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /*
0002  * Copyright (c) 2019 Opticks Team. All Rights Reserved.
0003  *
0004  * This file is part of Opticks
0005  * (see https://bitbucket.org/simoncblyth/opticks).
0006  *
0007  * Licensed under the Apache License, Version 2.0 (the "License"); 
0008  * you may not use this file except in compliance with the License.  
0009  * You may obtain a copy of the License at
0010  *
0011  *   http://www.apache.org/licenses/LICENSE-2.0
0012  *
0013  * Unless required by applicable law or agreed to in writing, software 
0014  * distributed under the License is distributed on an "AS IS" BASIS, 
0015  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
0016  * See the License for the specific language governing permissions and 
0017  * limitations under the License.
0018  */
0019 
0020 // TEST=SArTest om-t
0021 
0022 #include <iostream>
0023 #include <cassert>
0024 
0025 #include "SAr.hh"
0026 #include "SSys.hh"
0027 
0028 
0029 void dump(const char* msg, const SAr& a)
0030 {
0031     std::cout << msg << std::endl ; 
0032 
0033     std::cout << " exepath() " << a.exepath() << std::endl ; 
0034     std::cout << " exename() " << a.exename() << std::endl ; 
0035     std::cout << " cmdline() " << a.cmdline() << std::endl ; 
0036 }
0037 
0038 
0039 
0040 void test_a(int argc, char** argv)
0041 {
0042     SAr a(argc, argv );
0043     std::cout << "a instanciated " << std::endl ; 
0044     a.dump();
0045     std::cout << "a dumped " << std::endl ; 
0046 
0047     const char* option = "--gdmlpath" ; 
0048     const char* fallback = NULL ; 
0049     const char* value = a.get_arg_after(option, fallback) ; 
0050     std::cout 
0051         << " option " << option
0052         << " value " << ( value ? value : "-" ) 
0053         << std::endl 
0054         ;
0055 
0056    dump("test_a", a );  
0057 }
0058 
0059 void test_b()
0060 {
0061     const char* key = "SAR_TEST" ; 
0062     const char* val = "--trace --SYSRAP warning red green blue" ; 
0063     bool overwrite = true ; 
0064     SSys::setenvvar( key, val , overwrite ) ;  
0065 
0066     SAr b(0,0, key, ' ') ;
0067     std::cout << "b instanciated " << std::endl ; 
0068     b.dump() ; 
0069     std::cout << "b dumped " << std::endl ; 
0070 
0071     assert( b._argc == 7 ); 
0072 }
0073 
0074 
0075 void test_c()
0076 {
0077     SAr c("SArTestOne"); 
0078     c.dump(); 
0079     dump("test_c", c );  
0080 }
0081 
0082 
0083 int main(int argc, char** argv)
0084 {
0085     std::cout << "start" << std::endl ; 
0086 
0087     //test_a(argc, argv); 
0088     //test_b(); 
0089     test_c(); 
0090 
0091     return 0 ; 
0092 }