LRAUV  revA
Timestamp_Test Class Reference

Unit Tests for class Timestamp. More...

#include <Timestamp_Test.h>

Inheritance diagram for Timestamp_Test:
Collaboration diagram for Timestamp_Test:

Public Member Functions

void testConstructorNoArguments (void)
 Tests:

  1. Create a new object w/o params.
More...
 
void testConstructorStringArg (void)
 
void testConstructorDoubleArg (void)
 
void testConstructorCopyArg (void)
 Constructor with copy param tests

  1. Create new object copied from another object.
More...
 
void testCopyOperator (void)
 Copy operator. More...
 
void testSetOperatorOne (void)
 Set operator. More...
 
void testSetOperatorTwo (void)
 
void testInPlaceAdditionToTimespan (void)
 In-place addition operator to timespan Tests:

  1. Create to timestamp objects with params A timespan B.
More...
 
void testInPlaceSubtractionByTimespan (void)
 In-place subtraction operator to timespan Tests:

  1. Create to timestamp objects with params A timespan B.
More...
 
void testAdditionAndSubtraction (void)
 Standard addition/subtraction functions. More...
 
void testInquality (void)
 Inequality operator. More...
 
void testSleepNow (void)
 Test the sleepTill function. More...
 
void testNow (void)
 
void testWholeUnits (void)
 Test whole units. More...
 
void testToString (void)
 

Detailed Description

Unit Tests for class Timestamp.

Member Function Documentation

void Timestamp_Test::testAdditionAndSubtraction ( void  )
inline

Standard addition/subtraction functions.

Tests for each:

  1. Create double A and B (A>B). Create timestampA, and timespanB.
  2. Verify timestampA + timespanB = A+B
  3. Verify timestampA - timespanB = A-B
  4. Verify timestampA - timestampB = A-B
  5. Repeat above with B>A

References TIMESPAN_FUDGE().

void Timestamp_Test::testConstructorCopyArg ( void  )
inline

Constructor with copy param tests

  1. Create new object copied from another object.

asDouble == asDouble

  1. Create new object copied from another object. Equal with == operator

References Timestamp::asDouble().

void Timestamp_Test::testConstructorDoubleArg ( void  )
inline

References Timestamp::asDouble().

void Timestamp_Test::testConstructorNoArguments ( void  )
inline

Tests:

  1. Create a new object w/o params.

Expect asDouble() == 0

  1. Create a new object with double param, Expect asDouble() == param

References Timestamp::asDouble(), and Timestamp::NOT_SET_TIME.

void Timestamp_Test::testConstructorStringArg ( void  )
inline

References Timestamp::asDouble().

void Timestamp_Test::testCopyOperator ( void  )
inline

Copy operator.

Test:

  1. Create two objects with different double params. Test they are different. Use copy to set one to the other. Test they are same with equality operator.
void Timestamp_Test::testInPlaceAdditionToTimespan ( void  )
inline

In-place addition operator to timespan Tests:

  1. Create to timestamp objects with params A timespan B.

Sum objects A+=B. Verify (A+B).asDouble() == (A.asDouble + B.asDouble )

References Timestamp::asDouble(), DOUBLE_FUDGE, and TIMESPAN_FUDGE().

void Timestamp_Test::testInPlaceSubtractionByTimespan ( void  )
inline

In-place subtraction operator to timespan Tests:

  1. Create to timestamp objects with params A timespan B.

Subtract objects A-=B. Verify (A-B).asDouble() == (A.asDouble - B.asDouble )

References Timestamp::asDouble(), DOUBLE_FUDGE, and TIMESPAN_FUDGE().

void Timestamp_Test::testInquality ( void  )
inline

Inequality operator.

Tests:

  1. Generate two times A and B with A > B. Verify A>B true and A<B false.
void Timestamp_Test::testNow ( void  )
inline

References Timestamp::Now().

void Timestamp_Test::testSetOperatorOne ( void  )
inline

Set operator.

Test:

  1. Create object with double param A. Test asDouble is not equal to B. Use operator to set to B. Test asDouble is equal to B
  2. Create two objects with different double params. Test they are different. Use copy to set one to the other's asDouble. Test they are same with equality operator.

References Timestamp::asDouble().

void Timestamp_Test::testSetOperatorTwo ( void  )
inline

References Timestamp::asDouble().

void Timestamp_Test::testSleepNow ( void  )
inline

Test the sleepTill function.

References Timespan::Milliseconds(), Timestamp::Now(), and Timestamp::sleepTill().

void Timestamp_Test::testToString ( void  )
inline
void Timestamp_Test::testWholeUnits ( void  )
inline

The documentation for this class was generated from the following file: