Changeset 457 for trunk/Source/Base/Base/OSGBaseFunctionsTest.cpp
- Timestamp:
- 12/24/06 07:27:43 (2 years ago)
- Files:
-
- trunk/Source/Base/Base/OSGBaseFunctionsTest.cpp (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Source/Base/Base/OSGBaseFunctionsTest.cpp
r288 r457 44 44 #include "OpenSG/OSGBaseFunctions.h" 45 45 46 #include "OpenSG/OSGLog.h"47 48 46 // This test is incomplete, it only tests: 49 47 // * byte order swapping … … 53 51 using namespace UnitTest; 54 52 55 namespace { 56 53 SUITE(BaseFunctionsTests) 54 { 55 57 56 struct ByteOrderFixture 58 57 { 59 58 ByteOrderFixture() 60 59 { 61 OSG::UInt8 bytes_a[] = 60 OSG::UInt8 bytes_a[] = 62 61 { 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78 }; 63 62 OSG::UInt8 bytes_b[] = 64 63 { 0x78, 0x77, 0x76, 0x75, 0x74, 0x73, 0x72, 0x71 }; 65 64 66 65 int16_a = *reinterpret_cast<OSG::Int16*> (&(bytes_a[0])); 67 66 int16_b = *reinterpret_cast<OSG::Int16*> (&(bytes_b[6])); 68 67 uint16_a = *reinterpret_cast<OSG::UInt16*>(&(bytes_a[0])); 69 68 uint16_b = *reinterpret_cast<OSG::UInt16*>(&(bytes_b[6])); 70 69 71 70 int32_a = *reinterpret_cast<OSG::Int32*> (&(bytes_a[0])); 72 71 int32_b = *reinterpret_cast<OSG::Int32*> (&(bytes_b[4])); 73 72 uint32_a = *reinterpret_cast<OSG::UInt32*>(&(bytes_a[0])); 74 73 uint32_b = *reinterpret_cast<OSG::UInt32*>(&(bytes_b[4])); 75 74 76 75 int64_a = *reinterpret_cast<OSG::Int64*> (&(bytes_a[0])); 77 76 int64_b = *reinterpret_cast<OSG::Int64*> (&(bytes_b[0])); … … 233 232 typedef OSG::TypeTraits<OSG::UInt32> TTU32; 234 233 typedef OSG::TypeTraits<OSG::Int32> TTS32; 235 234 236 235 typedef OSG::TypeTraits<OSG::UInt64> TTU64; 237 236 typedef OSG::TypeTraits<OSG::Int64> TTS64; … … 244 243 CHECK( OSG::osgIsPower2((TTS32::getOneElement() << 30) )); 245 244 CHECK(!OSG::osgIsPower2((TTS32::getOneElement() << 30) + TTS32::getOneElement())); 246 245 247 246 CHECK( OSG::osgIsPower2(OSG_UINT32_LITERAL(0))); 248 247 CHECK( OSG::osgIsPower2(OSG_UINT32_LITERAL(1))); … … 251 250 CHECK( OSG::osgIsPower2((TTU32::getOneElement() << 31) )); 252 251 CHECK(!OSG::osgIsPower2((TTU32::getOneElement() << 31) + TTS32::getOneElement())); 253 252 254 253 CHECK( OSG::osgIsPower2(OSG_INT64_LITERAL(0))); 255 254 CHECK( OSG::osgIsPower2(OSG_INT64_LITERAL(1))); … … 259 258 CHECK( OSG::osgIsPower2((TTS64::getOneElement() << 62) )); 260 259 CHECK(!OSG::osgIsPower2((TTS64::getOneElement() << 62) + TTS64::getOneElement())); 261 260 262 261 CHECK( OSG::osgIsPower2(OSG_UINT64_LITERAL(0))); 263 262 CHECK( OSG::osgIsPower2(OSG_UINT64_LITERAL(1))); … … 266 265 CHECK( OSG::osgIsPower2((TTU64::getOneElement() << 63) )); 267 266 CHECK(!OSG::osgIsPower2((TTU64::getOneElement() << 63) + TTS64::getOneElement())); 268 267 269 268 #undef OSG_INT32_LITERAL 270 269 #undef OSG_UINT32_LITERAL … … 288 287 typedef OSG::TypeTraits<OSG::UInt32> TTU32; 289 288 typedef OSG::TypeTraits<OSG::Int32> TTS32; 290 289 291 290 typedef OSG::TypeTraits<OSG::UInt64> TTU64; 292 291 typedef OSG::TypeTraits<OSG::Int64> TTS64; 293 292 294 293 CHECK_EQUAL(OSG::osgNextPower2(OSG_INT32_LITERAL(0)), 1); 295 294 CHECK_EQUAL(OSG::osgNextPower2(OSG_INT32_LITERAL(1)), 1); … … 298 297 TTS32::getOneElement() << 30); 299 298 CHECK_EQUAL(OSG::osgNextPower2((TTS32::getOneElement() << 30) + TTS32::getOneElement()), 0); 300 299 301 300 CHECK_EQUAL(OSG::osgNextPower2(OSG_UINT32_LITERAL(0)), 1); 302 301 CHECK_EQUAL(OSG::osgNextPower2(OSG_UINT32_LITERAL(1)), 1); … … 305 304 TTU32::getOneElement() << 31); 306 305 CHECK_EQUAL(OSG::osgNextPower2((TTU32::getOneElement() << 31) + TTU32::getOneElement()), 0); 307 306 308 307 CHECK_EQUAL(OSG::osgNextPower2(OSG_INT64_LITERAL(0)), 1); 309 308 CHECK_EQUAL(OSG::osgNextPower2(OSG_INT64_LITERAL(1)), 1); … … 312 311 TTS64::getOneElement() << 62); 313 312 CHECK_EQUAL(OSG::osgNextPower2((TTS64::getOneElement() << 62) + TTS64::getOneElement()), 0); 314 313 315 314 CHECK_EQUAL(OSG::osgNextPower2(OSG_UINT64_LITERAL(0)), 1); 316 315 CHECK_EQUAL(OSG::osgNextPower2(OSG_UINT64_LITERAL(1)), 1); … … 319 318 TTU64::getOneElement() << 63); 320 319 CHECK_EQUAL(OSG::osgNextPower2((TTU64::getOneElement() << 63) + TTU64::getOneElement()), 0); 321 320 322 321 #undef OSG_INT32_LITERAL 323 322 #undef OSG_UINT32_LITERAL … … 326 325 } 327 326 328 } 327 } // SUITE
