File indexing completed on 2024-04-06 12:02:42
0001 #include "CondFormats/SiStripObjects/interface/SiStripConfObject.h"
0002
0003 #include <iostream>
0004
0005 int test( const bool testResult )
0006 {
0007 if( testResult ) {
0008 return 0;
0009 }
0010 std::cout << "test not passed" << std::endl;
0011 return 1;
0012 }
0013
0014 int main()
0015 {
0016 int errors = 0;
0017
0018 std::cout << "Testing SiStripConfObject" << std::endl;
0019
0020 SiStripConfObject conf;
0021 std::cout << "putting par1 with value 1" << std::endl;
0022 conf.put("par1", 1);
0023 std::cout << "putting par2 with value 2" << std::endl;
0024 conf.put("par2", 2);
0025
0026 std::cout << "Reading back parameters" << std::endl;
0027 std::cout << "getting par1 = " << conf.get("par1") << std::endl;
0028 errors += test( conf.get("par1") == 1 );
0029
0030 std::cout << "getting par2 = " << conf.get("par2") << std::endl;
0031 errors += test( conf.get("par2") == 2 );
0032
0033 std::cout << "Trying to read back a non-existent parameter, the test expects an error" << std::endl;
0034 std::cout << "getting par3 (non-existent) " << conf.get("par3") << std::endl;
0035 errors += test( conf.get("par3") == -1 );
0036
0037 if( errors == 0 ) {
0038 std::cout << "All tests passed" << std::endl;
0039 }
0040 else {
0041 std::cout << "ERROR: There were " << errors << " tests not passed" << std::endl;
0042 }
0043
0044 }