Show
Ignore:
Timestamp:
12/24/06 07:27:43 (2 years ago)
Author:
cneumann
Message:

Added copyright headers,
wrapped test contents in SUITEs

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Source/Base/Base/OSGBaseFunctionsTest.cpp

    r288 r457  
    4444#include "OpenSG/OSGBaseFunctions.h" 
    4545 
    46 #include "OpenSG/OSGLog.h" 
    47  
    4846// This test is incomplete, it only tests: 
    4947//  * byte order swapping 
     
    5351using namespace UnitTest; 
    5452 
    55 namespace { 
    56      
     53SUITE(BaseFunctionsTests) 
     54
     55 
    5756struct ByteOrderFixture 
    5857{ 
    5958    ByteOrderFixture() 
    6059    { 
    61         OSG::UInt8 bytes_a[] =  
     60        OSG::UInt8 bytes_a[] = 
    6261            { 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78 }; 
    6362        OSG::UInt8 bytes_b[] = 
    6463            { 0x78, 0x77, 0x76, 0x75, 0x74, 0x73, 0x72, 0x71 }; 
    65          
     64 
    6665        int16_a   = *reinterpret_cast<OSG::Int16*> (&(bytes_a[0])); 
    6766        int16_b   = *reinterpret_cast<OSG::Int16*> (&(bytes_b[6])); 
    6867        uint16_a  = *reinterpret_cast<OSG::UInt16*>(&(bytes_a[0])); 
    6968        uint16_b  = *reinterpret_cast<OSG::UInt16*>(&(bytes_b[6])); 
    70          
     69 
    7170        int32_a   = *reinterpret_cast<OSG::Int32*> (&(bytes_a[0])); 
    7271        int32_b   = *reinterpret_cast<OSG::Int32*> (&(bytes_b[4])); 
    7372        uint32_a  = *reinterpret_cast<OSG::UInt32*>(&(bytes_a[0])); 
    7473        uint32_b  = *reinterpret_cast<OSG::UInt32*>(&(bytes_b[4])); 
    75          
     74 
    7675        int64_a   = *reinterpret_cast<OSG::Int64*> (&(bytes_a[0])); 
    7776        int64_b   = *reinterpret_cast<OSG::Int64*> (&(bytes_b[0])); 
     
    233232    typedef OSG::TypeTraits<OSG::UInt32> TTU32; 
    234233    typedef OSG::TypeTraits<OSG::Int32>  TTS32; 
    235      
     234 
    236235    typedef OSG::TypeTraits<OSG::UInt64> TTU64; 
    237236    typedef OSG::TypeTraits<OSG::Int64>  TTS64; 
     
    244243    CHECK( OSG::osgIsPower2((TTS32::getOneElement() << 30)                         )); 
    245244    CHECK(!OSG::osgIsPower2((TTS32::getOneElement() << 30) + TTS32::getOneElement())); 
    246      
     245 
    247246    CHECK( OSG::osgIsPower2(OSG_UINT32_LITERAL(0))); 
    248247    CHECK( OSG::osgIsPower2(OSG_UINT32_LITERAL(1))); 
     
    251250    CHECK( OSG::osgIsPower2((TTU32::getOneElement() << 31)                         )); 
    252251    CHECK(!OSG::osgIsPower2((TTU32::getOneElement() << 31) + TTS32::getOneElement())); 
    253      
     252 
    254253    CHECK( OSG::osgIsPower2(OSG_INT64_LITERAL(0))); 
    255254    CHECK( OSG::osgIsPower2(OSG_INT64_LITERAL(1))); 
     
    259258    CHECK( OSG::osgIsPower2((TTS64::getOneElement() << 62)                         )); 
    260259    CHECK(!OSG::osgIsPower2((TTS64::getOneElement() << 62) + TTS64::getOneElement())); 
    261      
     260 
    262261    CHECK( OSG::osgIsPower2(OSG_UINT64_LITERAL(0))); 
    263262    CHECK( OSG::osgIsPower2(OSG_UINT64_LITERAL(1))); 
     
    266265    CHECK( OSG::osgIsPower2((TTU64::getOneElement() << 63)                         )); 
    267266    CHECK(!OSG::osgIsPower2((TTU64::getOneElement() << 63) + TTS64::getOneElement())); 
    268      
     267 
    269268#undef OSG_INT32_LITERAL 
    270269#undef OSG_UINT32_LITERAL 
     
    288287    typedef OSG::TypeTraits<OSG::UInt32> TTU32; 
    289288    typedef OSG::TypeTraits<OSG::Int32>  TTS32; 
    290      
     289 
    291290    typedef OSG::TypeTraits<OSG::UInt64> TTU64; 
    292291    typedef OSG::TypeTraits<OSG::Int64>  TTS64; 
    293      
     292 
    294293    CHECK_EQUAL(OSG::osgNextPower2(OSG_INT32_LITERAL(0)), 1); 
    295294    CHECK_EQUAL(OSG::osgNextPower2(OSG_INT32_LITERAL(1)), 1); 
     
    298297                TTS32::getOneElement() << 30); 
    299298    CHECK_EQUAL(OSG::osgNextPower2((TTS32::getOneElement() << 30) + TTS32::getOneElement()), 0); 
    300      
     299 
    301300    CHECK_EQUAL(OSG::osgNextPower2(OSG_UINT32_LITERAL(0)), 1); 
    302301    CHECK_EQUAL(OSG::osgNextPower2(OSG_UINT32_LITERAL(1)), 1); 
     
    305304                TTU32::getOneElement() << 31); 
    306305    CHECK_EQUAL(OSG::osgNextPower2((TTU32::getOneElement() << 31) + TTU32::getOneElement()), 0); 
    307      
     306 
    308307    CHECK_EQUAL(OSG::osgNextPower2(OSG_INT64_LITERAL(0)), 1); 
    309308    CHECK_EQUAL(OSG::osgNextPower2(OSG_INT64_LITERAL(1)), 1); 
     
    312311                TTS64::getOneElement() << 62); 
    313312    CHECK_EQUAL(OSG::osgNextPower2((TTS64::getOneElement() << 62) + TTS64::getOneElement()), 0); 
    314      
     313 
    315314    CHECK_EQUAL(OSG::osgNextPower2(OSG_UINT64_LITERAL(0)), 1); 
    316315    CHECK_EQUAL(OSG::osgNextPower2(OSG_UINT64_LITERAL(1)), 1); 
     
    319318                TTU64::getOneElement() << 63); 
    320319    CHECK_EQUAL(OSG::osgNextPower2((TTU64::getOneElement() << 63) + TTU64::getOneElement()), 0); 
    321      
     320 
    322321#undef OSG_INT32_LITERAL 
    323322#undef OSG_UINT32_LITERAL 
     
    326325} 
    327326 
    328 } 
     327} // SUITE