//===========================================================================// // File: time.tst // // Project: MUNGA Brick: Time Manager // // Contents: Test stuff for time // //---------------------------------------------------------------------------// // Date Who Modification // // -------- --- ---------------------------------------------------------- // // 10/24/94 JMA Initial coding. // // 10/28/94 JMA Made compatible with SGI CC // // 11/03/94 ECH Made compatible with BC4.0 // //---------------------------------------------------------------------------// // Copyright (C) 1994, Virtual World Entertainment, Inc. All Rights reserved // // PROPRIETARY AND CONFIDENTIAL // //===========================================================================// //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Time ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // //############################################################################# //############################################################################# // Logical Time::TestClass() { DEBUG_STREAM << "Starting Time test...\n"; Time a, b, c; Scalar f; long t; // //---------------- // Test assignment //---------------- // a = 1.0f; b = 2.0f; c = Null; c = a; Test(a <= c); Test(a >= c); c = 1.0f; Test(c <= a); Test(c >= a); c = b.ticks; Test(c <= b); Test(c >= b); // //---------------------- // Test time comparators //---------------------- // Test(a < b); Test(a <= b); Test(b > a); Test(b >= a); // //------------- // Test casting //------------- // f = c; Test(Close_Enough(f,2.0f)); t = a; Test(t == a.ticks); // //-------------------- // Test math functions //-------------------- // c = a; c += 1.0f; Test(c.ticks == b.ticks); c -= a; Test(c.ticks == a.ticks); c = b; c -= 1.0f; Test(c.ticks == a.ticks); c += a; Test(c.ticks == b.ticks); // // This test checks to see if the Scalar value is within the resolution // of half a tick // f = b - a; Test(Close_Enough(f, 1.0f, 0.5f * (1.0f / SystemClock::ticksPerSecond))); return True; }