Files
TeslaRel410/CODE/RP/MUNGA/TIME.TCP
T
CydandClaude Fable 5 fdd9ac9d97 Initial import: Tesla Release 4.10 (Tesla:BattleTech & Tesla:Red Planet)
Archival snapshot of the Virtual World Entertainment Tesla cockpit
software, 1994-1996: MUNGA engine and L4 pod layer source (Borland
C++ 5.0), BT/RP game code, and game content (models, audio, maps,
gauges, Division renderer data). Includes third-party libraries:
Division dVS/DPL graphics, HMI SOS audio, WATTCP networking.

Files are preserved byte-for-byte (.gitattributes disables all
line-ending conversion). README.md documents the layout, target
hardware, and toolchain.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-02 13:21:58 -05:00

101 lines
2.5 KiB
Plaintext

//===========================================================================//
// 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;
}