File indexing completed on 2026-04-09 07:49:17
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include "OPTICKS_LOG.hh"
0021 #include "SGDML.hh"
0022
0023
0024 struct Demo
0025 {
0026 int answer ;
0027 };
0028
0029
0030 void test_GenerateName()
0031 {
0032 Demo* d = new Demo { 42 } ;
0033 LOG(info) << SGDML::GenerateName( "Demo", d, true );
0034 }
0035
0036
0037
0038 void test_Strip()
0039 {
0040 LOG(info) ;
0041 std::vector<std::string> names = { "hell0xc0ffee" , "world0xdeadbeef", "hello0xworld0xcruel", "0xhello", "name_without_0X_lowercase", } ;
0042 std::vector<std::string> xnames = { "hell" , "world", "hello", "" , "name_without_0X_lowercase"} ;
0043
0044 for(int i=0 ; i < int(names.size()) ; i++)
0045 {
0046 const std::string& xname = xnames[i] ;
0047 const std::string& name = names[i] ;
0048 std::string sname = SGDML::Strip(name) ;
0049 std::string sname2 = SGDML::Strip(name.c_str()) ;
0050
0051 std::cout
0052 << std::setw(3) << i
0053 << " : "
0054 << std::setw(50) << name
0055 << " : "
0056 << std::setw(50) << sname
0057 << " : "
0058 << std::setw(50) << xname
0059 << std::endl
0060 ;
0061
0062 assert( strcmp(xname.c_str(), sname.c_str()) == 0 );
0063 assert( strcmp(sname.c_str(), sname2.c_str()) == 0 );
0064 }
0065 }
0066
0067
0068
0069 int main(int argc, char** argv)
0070 {
0071 OPTICKS_LOG(argc, argv);
0072
0073 test_GenerateName();
0074 test_Strip();
0075
0076 return 0 ;
0077 }
0078
0079
0080