Show
Ignore:
Timestamp:
09/02/03 22:03:01 (11 years ago)
Author:
robert
Message:

Added test of sizeof(types) - run osgunittests sizeof.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgunittests/osgunittests.cpp

    r2039 r2222  
    8383} 
    8484 
     85void sizeOfTest() 
     86{ 
     87  std::cout<<"sizeof(bool)=="<<sizeof(bool)<<std::endl; 
     88  std::cout<<"sizeof(char)=="<<sizeof(char)<<std::endl; 
     89  std::cout<<"sizeof(short)=="<<sizeof(short)<<std::endl; 
     90  std::cout<<"sizeof(int)=="<<sizeof(int)<<std::endl; 
     91  std::cout<<"sizeof(long)=="<<sizeof(long)<<std::endl; 
     92  std::cout<<"sizeof(long int)=="<<sizeof(long int)<<std::endl; 
     93 
     94#if defined(_MSC_VER) 
     95  // long long isn't supported on VS6.0... 
     96  std::cout<<"sizeof(__int64)=="<<sizeof(__int64)<<std::endl; 
     97#else 
     98  std::cout<<"sizeof(long long)=="<<sizeof(long long)<<std::endl; 
     99#endif 
     100  std::cout<<"sizeof(float)=="<<sizeof(float)<<std::endl; 
     101  std::cout<<"sizeof(double)=="<<sizeof(double)<<std::endl; 
     102} 
     103 
    85104int main( int argc, char** argv ) 
    86105{ 
     
    92111    arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); 
    93112    arguments.getApplicationUsage()->addCommandLineOption("qt","Display qualified tests."); 
     113    arguments.getApplicationUsage()->addCommandLineOption("sizeof","Display sizeof tests."); 
    94114    arguments.getApplicationUsage()->addCommandLineOption("matrix","Display qualified tests."); 
    95115  
     
    104124    while (arguments.read("qt")) printQualifiedTest = true;  
    105125 
    106     bool displayMatrixTest = false;  
    107     while (arguments.read("matrix")) displayMatrixTest = true;  
     126    bool printMatrixTest = false;  
     127    while (arguments.read("matrix")) printMatrixTest = true;  
     128 
     129    bool printSizeOfTest = false;  
     130    while (arguments.read("sizeof")) printSizeOfTest = true;  
    108131 
    109132    // if user request help write it out to cout. 
     
    126149     
    127150 
    128     if (displayMatrixTest) 
     151    if (printMatrixTest) 
    129152    { 
    130153        std::cout<<"******   Running matrix tests   ******"<<std::endl; 
     
    139162        testLookAt(osg::Vec3(10.0,4.0,2.0),osg::Vec3(10.0,4.0,2.0)+osg::Vec3(1.0,1.0,0.0),osg::Vec3(0.0,0.0,1.0)); 
    140163 
     164    } 
     165     
     166    if (printSizeOfTest) 
     167    { 
     168        std::cout<<"**** sizeof() tests  ******"<<std::endl; 
     169         
     170        sizeOfTest(); 
     171 
     172        std::cout<<std::endl; 
    141173    } 
    142174