Beispiel #1
0
	int operatorTest(void)
	{
		TestUtil testFramework("ObsID", "== Operator", __FILE__, __LINE__);
		std::string failMesg;

		gpstk::ObsID Compare1(gpstk::ObsID::otRange, gpstk::ObsID::cbL1, gpstk::ObsID::tcCA);
		gpstk::ObsID Compare2(gpstk::ObsID::otRange, gpstk::ObsID::cbL1, gpstk::ObsID::tcCA);
		gpstk::ObsID Compare3(gpstk::ObsID::otDoppler, gpstk::ObsID::cbL1, gpstk::ObsID::tcCA);		

		failMesg = "Are equivalent objects equivalent?";
		testFramework.assert(Compare1 == Compare2, failMesg, __LINE__);

		failMesg = "Are non-equivalent objects equivalent?";
		testFramework.assert(!(Compare1 == Compare3), failMesg, __LINE__);

		testFramework.changeSourceMethod("!= Operator");

		failMesg = "Are non-equivalent objects not equivalent?";
		testFramework.assert(Compare1 != Compare3, failMesg, __LINE__);

		failMesg = "Are equivalent objects not equivalent?";
		testFramework.assert(!(Compare1 != Compare2), failMesg, __LINE__);

		return testFramework.countFails();
	}
Beispiel #2
0
//==========================================================================================================================
// initializationTest ensures the constructors set the values properly
//==========================================================================================================================
   int initializationTest(void)
   {
      gpstk::TestUtil testFramework( "SatID", "Constructor", __FILE__, __LINE__);

      gpstk::SatID Compare1(5, gpstk::SatID::SatelliteSystem (1));
      testFramework.assert(Compare1.id == 5,
                           "Explicit constructor did not set the correct id value", __LINE__);
      testFramework.assert(Compare1.system == gpstk::SatID::SatelliteSystem(1),
                           "Explicit constructor did not set the correct SatelliteSystem", __LINE__);


      gpstk::SatID Compare2(0, gpstk::SatID::SatelliteSystem (12));
      testFramework.assert(Compare2.id == 0,
                           "Explicit constructor did not set the correct id value", __LINE__);
      testFramework.assert(Compare2.system == gpstk::SatID::SatelliteSystem(12),
                           "Explicit constructor did not set the correct SatelliteSystem", __LINE__);


      gpstk::SatID Compare3(-1, gpstk::SatID::SatelliteSystem (-1));
      testFramework.assert(Compare3.id == -1,
                           "Explicit constructor did not set the correct id value", __LINE__);
      testFramework.assert(Compare3.system == gpstk::SatID::SatelliteSystem(-1),
                           "Explicit constructor did not set the correct SatelliteSystem", __LINE__);

      return testFramework.countFails();
   }
Beispiel #3
0
//==========================================================================================================================
// isValidTest checks that the isValid method returns the proper value
//==========================================================================================================================
   int isValidTest(void)
   {
      gpstk::TestUtil testFramework( "SatID", "isValid()", __FILE__, __LINE__);


      gpstk::SatID Compare1(5  , gpstk::SatID::SatelliteSystem(1) );
      gpstk::SatID Compare2(1  , gpstk::SatID::SatelliteSystem(14));
      gpstk::SatID Compare3(-1 , gpstk::SatID::SatelliteSystem(-1));
      gpstk::SatID Compare4(100, gpstk::SatID::SatelliteSystem(-1));
      gpstk::SatID Compare5(0  , gpstk::SatID::SatelliteSystem(1) );
      gpstk::SatID Compare6(32 , gpstk::SatID::SatelliteSystem(1) );
      gpstk::SatID Compare7(50 , gpstk::SatID::SatelliteSystem(1) );
      gpstk::SatID Compare8(0  , gpstk::SatID::SatelliteSystem(1) );
      gpstk::SatID Compare9(-3 , gpstk::SatID::SatelliteSystem(1) );


      testFramework.assert( Compare1.isValid(),
                            "isValid returned false for a valid SatID"                        , __LINE__);
      testFramework.assert( Compare2.isValid(),
                            "isValid returned false for a valid undefined SatSys"             , __LINE__);
      testFramework.assert(!Compare3.isValid(),
                           "isValid returned true for an invalid SatSys with negative ID"    , __LINE__);
      testFramework.assert(!Compare4.isValid(),
                           "isValid returned true for an invalid SatSys with triple digit ID", __LINE__);
      testFramework.assert(!Compare5.isValid(),
                           "isValid returned true for an invalid SatSys with zero ID"        , __LINE__);
      testFramework.assert( Compare6.isValid(),
                            "isValid returned false for an valid GPS SatSys"                  , __LINE__);
      testFramework.assert(!Compare7.isValid(),
                           "isValid returned true for a GPS SatSys with ID > 32"             , __LINE__);
      testFramework.assert(!Compare8.isValid(),
                           "isValid returned true for a GPS SatSys with 0 ID"                , __LINE__);
      testFramework.assert(!Compare9.isValid(),
                           "isValid returned true for a GPS SatSys with negative ID"         , __LINE__);

      return testFramework.countFails();
   }
Beispiel #4
0
    /// Constructor.
    /// \param comp1 The predicate (less) for the first variable, if needed.
    /// \param comp2 The predicate (less) for the second variable, if needed.
    /// \param comp3 The predicate (less) for the third variable, if needed.
	TableFunction3(const Compare1& comp1 = Compare1(), const Compare2& comp2 = Compare2(), const Compare3& comp3 = Compare3())
	: MapType(comp1), default_(comp2, comp3) {}
Beispiel #5
0
    /// Constructor.
    /// \param comp1 The predicate (less) for variable 1, if needed.
    /// \param comp2 The predicate (less) for variable 2, if needed.
	TableFunction2(const Compare1& comp1 = Compare1(), const Compare2& comp2 = Compare2()) : MapType(comp1), default_(comp2) {}
Beispiel #6
0
   int operatorTest(void)
   {
      gpstk::TestUtil testFramework( "ValidType", "== Operator", __FILE__, __LINE__ );
      std::string failMesg;

      gpstk::ValidType<float> Compare1 (6.);
      gpstk::ValidType<float> Compare2 (6.);
      gpstk::ValidType<float> Compare3 (8.);
      gpstk::ValidType<int> Compare4 (6);
      gpstk::ValidType<float> vfloat;

      failMesg = "Are two equvalent objects equal?";
      testFramework.assert(Compare1 == Compare2, failMesg, __LINE__);

      failMesg = "Are two non-equvalent objects equal?";
      testFramework.assert(Compare1 != Compare3, failMesg, __LINE__);

      vfloat = 7.;

      testFramework.changeSourceMethod("= Operator");
      failMesg = "Did the = operator store the value correctly?";
      testFramework.assert(vfloat.get_value() == 7., failMesg, __LINE__);

      failMesg = "Did the = operator set the object as valid?";
      testFramework.assert(vfloat.is_valid(), failMesg, __LINE__);

      testFramework.changeSourceMethod("+= Operator");

      vfloat += 3.;
      failMesg = "Did the += operator store the value correctly?";
      testFramework.assert(vfloat.get_value() == 10., failMesg, __LINE__);

      failMesg = "Did the += operator change the object's valid bool?";
      testFramework.assert(vfloat.is_valid(), failMesg, __LINE__);		

      testFramework.changeSourceMethod("-= Operator");

      vfloat -= 5.;

      failMesg = "Did the -= operator store the value correctly?";
      testFramework.assert(vfloat.get_value() == 5., failMesg, __LINE__);

      failMesg = "Did the -= operator change the object's valid bool?";
      testFramework.assert(vfloat.is_valid(), failMesg, __LINE__);

      testFramework.changeSourceMethod("<< Operator");

      vfloat = 11;

      std::stringstream streamOutput;
      std::string stringOutput;
      std::string stringCompare;

      streamOutput <<  vfloat;
      stringOutput = streamOutput.str();

      stringCompare = "11";

      failMesg = "Did the << operator ouput valid object correctly?";
      testFramework.assert(stringCompare == stringOutput, failMesg, __LINE__);

      streamOutput.str("");	// Resetting stream
      vfloat.set_valid(false);

      streamOutput << vfloat;
      stringOutput = streamOutput.str();

      stringCompare = "Unknown";

      failMesg = " Did the << operator output invalid object correctly?";
      testFramework.assert(stringCompare == stringOutput, failMesg, __LINE__);

      return testFramework.countFails();
   }
Beispiel #7
0
	int observationsTest(void)
	{
		TestUtil testFramework("WxObsMap", "Default Constructor", __FILE__, __LINE__);
		std::string failMesg;

		gpstk::WxObservation Compare;

		failMesg = "Was the time value set correctly?";
		testFramework.assert(Compare.t == gpstk::CommonTime::END_OF_TIME, failMesg, __LINE__);

		failMesg = "Was the temperature source set correctly?";
		testFramework.assert(Compare.temperatureSource == gpstk::WxObservation::noWx, failMesg, __LINE__);

		failMesg = "Was the pressure source set correctly?";
		testFramework.assert(Compare.pressureSource == gpstk::WxObservation::noWx, failMesg, __LINE__);

		failMesg = "Was the humidity source set correctly?";
		testFramework.assert(Compare.humiditySource == gpstk::WxObservation::noWx, failMesg, __LINE__);

		gpstk::CommonTime cTime;
		cTime.set(500005,6,.7);

		gpstk::WxObservation Compare1(cTime, 100, .5f, .8f);

		testFramework.changeSourceMethod("Explicit Constructor");

		failMesg = "Was the time value set correctly?";
		testFramework.assert(Compare1.t == cTime, failMesg, __LINE__);

		failMesg = "Was the temperature value set correctly?";
		testFramework.assert(abs(Compare1.temperature - 100) < singlePrecisionError, failMesg, __LINE__);

		failMesg = "Was the pressure value set correctly?";
		testFramework.assert(abs(Compare1.pressure - 0.5) < singlePrecisionError, failMesg, __LINE__);

		failMesg = "Was the humidity value set correctly?";
		testFramework.assert(abs(Compare1.humidity - 0.8) < singlePrecisionError, failMesg, __LINE__);

		failMesg = "Was the temperature source set correctly?";
		testFramework.assert(Compare1.temperatureSource == gpstk::WxObservation::obsWx, failMesg, __LINE__);

		failMesg = "Was the temperature source set correctly?";
		testFramework.assert(Compare1.pressureSource == gpstk::WxObservation::obsWx, failMesg, __LINE__);

		failMesg = "Was the temperature source set correctly?";
		testFramework.assert(Compare1.humiditySource == gpstk::WxObservation::obsWx, failMesg, __LINE__);

		testFramework.changeSourceMethod("isAllValid");

		failMesg = "Does the isAllValid method function properly?";
		testFramework.assert(Compare1.isAllValid(), failMesg, __LINE__);

		testFramework.changeSourceMethod("<< Operator");

		std::string outputString, referenceString;
		std::stringstream outputStream, referenceStream;
		outputStream << Compare1;
		outputString = outputStream.str();
		referenceStream << cTime << ", t=" << 100 << ", p=" << 0.5 << ", rh=" << 0.8;
		referenceString =  referenceStream.str();

		failMesg = "Does the << operator function properly?";
		testFramework.assert(referenceString == outputString, failMesg, __LINE__);

		return testFramework.countFails();
	}