Exemplo n.º 1
0
      // initializationTest ensures the constructors set the values properly
   unsigned initializationTest()
   {
      TUDEF("GPSWeekSecond", "Constructor");

      GPSWeekSecond compare(1300,13500.,TimeSystem(2)); //Initialize an object
         //--------------------------------------------------------------------
         //Were the attributes set to expectation with the explicit
         //constructor?
         //--------------------------------------------------------------------
      TUASSERTE(int, 1300, compare.week);
      TUASSERTFE(13500, compare.sow);
      TUASSERTE(TimeSystem, TimeSystem(2), compare.getTimeSystem());


      testFramework.changeSourceMethod("ConstructorCopy");
      GPSWeekSecond copy(compare); // Initialize with copy constructor
         //--------------------------------------------------------------------
         //Were the attributes set to expectation with the copy constructor?
         //--------------------------------------------------------------------
      TUASSERTE(int, 1300, copy.week);
      TUASSERTFE(13500, copy.sow);
      TUASSERTE(TimeSystem, TimeSystem(2), copy.getTimeSystem());

      testFramework.changeSourceMethod("operator=");
      GPSWeekSecond assigned;
      assigned = compare;
         //--------------------------------------------------------------------
         //Were the attributes set to expectation with the Set operator?
         //--------------------------------------------------------------------
      TUASSERTE(int, 1300, assigned.week);
      TUASSERTFE(13500, assigned.sow);
      TUASSERTE(TimeSystem, TimeSystem(2), assigned.getTimeSystem());

      TURETURN();
   }
Exemplo n.º 2
0
//=============================================================================
//	initializationTest ensures the constructors set the values properly
//=============================================================================
   int initializationTest(void)
   {
      TestUtil testFramework( "GPSWeekSecond", "Constructor", __FILE__, __LINE__ );

      GPSWeekSecond Compare(1300,13500.,TimeSystem(2)); //Initialize an object
         //--------------------------------------------------------------------
         //Were the attributes set to expectation with the explicit
         //constructor?
         //--------------------------------------------------------------------
      testFramework.assert(1300 == Compare.week,                     "Explicit constructor did not set the week value properly", __LINE__);
      testFramework.assert(fabs((double)13500 - Compare.sow) < eps,  "Explicit constructor did not set the sow value properly",  __LINE__);
      testFramework.assert(TimeSystem(2) == Compare.getTimeSystem(), "Explicit constructor did not set the TimeSystem properly", __LINE__);


      testFramework.changeSourceMethod("ConstructorCopy");
      GPSWeekSecond Copy(Compare); // Initialize with copy constructor
         //--------------------------------------------------------------------
         //Were the attributes set to expectation with the copy constructor?
         //--------------------------------------------------------------------
      testFramework.assert(1300 == Copy.week,                     "Copy constructor did not set the week value properly", __LINE__);
      testFramework.assert(fabs((double)13500 - Copy.sow) < eps,  "Copy constructor did not set the sow value properly",  __LINE__);
      testFramework.assert(TimeSystem(2) == Copy.getTimeSystem(), "Copy constructor did not set the TimeSystem properly", __LINE__);


      testFramework.changeSourceMethod("OperatorSet");
      GPSWeekSecond Assigned;
      Assigned = Compare;
         //--------------------------------------------------------------------
         //Were the attributes set to expectation with the Set operator?
         //--------------------------------------------------------------------
      testFramework.assert(1300 == Assigned.week,                     "Set Operator did not set the week value properly", __LINE__);
      testFramework.assert(fabs((double)13500 - Assigned.sow) < eps,  "Set Operator did not set the sow value properly",  __LINE__);
      testFramework.assert(TimeSystem(2) == Assigned.getTimeSystem(), "Set Operator did not set the TimeSystem properly", __LINE__);

      return testFramework.countFails();
   }