Esempio n. 1
0
void
TestAssertTest::testAssertGreater()
{
    CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_GREATER( 1, 2 ) );
    CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_GREATER( 12345678, 12345679 ));

    CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_GREATER( 2, 1 ) );
    CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_GREATER( 2, 2 ) );
}
Esempio n. 2
0
void 
TestAssertTest::testAssertDoubleEquals()
{
  CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.1, 1.2, 0.101 ) );
  CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.2, 1.1, 0.101 ) );

  CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.1, 1.2, 0.09 ) );
  CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.2, 1.1, 0.09 ) );
}
Esempio n. 3
0
void Vector3iTest::testEquals()
{
	Vector3i inputA(-1, 22, -90);
	Vector3i inputB(-1, 22, -90);
	Vector3i inputC(42, -32, 0);
	
	CPPUNIT_ASSERT(inputA == inputB);
	CPPUNIT_ASSERT(inputA != inputC);
	
	CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT(inputA != inputB) );
	CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT(inputA == inputC) );
}
Esempio n. 4
0
/*
****Test to check and make sure that all of the execptions in the Ionomodel
****class are thrown where and as they are expected to

**** Please note:  As of June 29,2006 I have not found a way to get the blankAlmanac
**** exception to throw the way I wanted it to.  I have set it to assert fail so I can
**** come back at a later date to fix it.
*/
void xIonoModel :: exceptionTest (void)
{
	//Default constructer for Almanac will give a blank almanac
	gpstk::EngAlmanac blankAlmanac;
	//Set DayTime to the current system time
	gpstk::CommonTime commonTime;
	//Use the default Geodetic constructer
	gpstk::Position rxgeo;
	//Set el and az to 0 for ease of testing
	double svel = 0;
	double svaz = 0;
	//Easy alpha and beta for Ionospheric testing
	double a[4] = {1.,2.,3.,4.};
	double b[4] = {4.,3.,2.,1.};
	gpstk::IonoModel Model(blankAlmanac);
	gpstk::IonoModel goodModel(a,b);

	try
	{
	CPPUNIT_ASSERT_THROW(blankAlmanac.getIon(a,b),gpstk::InvalidRequest);
	//Questioning why this isnt failing auto fail for now
	CPPUNIT_ASSERT_ASSERTION_FAIL(CPPUNIT_ASSERT_THROW(gpstk::IonoModel Model(blankAlmanac),gpstk::Exception));
	CPPUNIT_ASSERT_THROW(Model.getCorrection(commonTime,rxgeo,svel,svaz,Model.L1),gpstk::IonoModel::InvalidIonoModel);
	CPPUNIT_ASSERT_NO_THROW(goodModel.getCorrection(commonTime,rxgeo,svel,svaz,Model.L1));
	CPPUNIT_ASSERT_NO_THROW(goodModel.getCorrection(commonTime,rxgeo,svel,svaz,Model.L2));
	CPPUNIT_ASSERT_NO_THROW(goodModel.getCorrection(commonTime,rxgeo,72.,45.,Model.L1));
	}
	catch(gpstk::Exception& e)
	{
	}
}
Esempio n. 5
0
void 
TestAssertTest::testAssert()
{
  CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT( true ) );
  
  CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT( false ) );
}
Esempio n. 6
0
void 
TestAssertTest::testAssertAssertionFail()
{
   CPPUNIT_ASSERT_ASSERTION_FAIL( throw CPPUNIT_NS::Exception() );

   try
   {
      CPPUNIT_ASSERT_ASSERTION_FAIL( 1234 );
   }
   catch ( CPPUNIT_NS::Exception & )
   {
      return;
   }

   throw std::exception();
}
Esempio n. 7
0
void
TestAssertTest::testAssertLess()
{
    CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_LESS( 2, 1 ) );
    CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_LESS( 12345679, 12345678 ) );

    CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_LESS( 1, 2 ) );
}
Esempio n. 8
0
void 
XmlUniformiserTest::testAssertXmlEqual()
{
  CPPUNIT_ASSERT_ASSERTION_FAIL( 
     CPPUNITTEST_ASSERT_XML_EQUAL( "<Test>", "<Tes>" ) );
  CPPUNIT_ASSERT_ASSERTION_PASS( 
     CPPUNITTEST_ASSERT_XML_EQUAL( "<Test>", "<Test>" ) );
}
Esempio n. 9
0
void 
TestAssertTest::testAssertEqual()
{
  CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_EQUAL( 1, 1 ) );
  CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_EQUAL( 1, foo() ) );
  CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_EQUAL( 12345678, 12345678 ) );

  CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_EQUAL( 1, 2 ) );
}
Esempio n. 10
0
void Vector3fTest::testDotProduct()
{
	Vector3f inputA(-3.3f, 2.2f, 8.8f);
	Vector3f inputB(-5.0f, 7.0f, 18.0f);
	
	float expected = 190.3f;
	float largeDelta = 0.0002f;
	float smallDelta = 0.000005f;
	
	float actualA = inputA.dot(inputB);
	
	CPPUNIT_ASSERT_DOUBLES_EQUAL(expected, actualA, largeDelta);
	CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL(expected, actualA, smallDelta) );
	
	Vector3i inputC(-5, 7, 18);
	
	float actualB = inputA.dot(inputC);
	
	CPPUNIT_ASSERT_DOUBLES_EQUAL(expected, actualB, largeDelta);
	CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL(expected, actualB, smallDelta) );
}
Esempio n. 11
0
void Vector3fTest::testDeterminant()
{
	Vector3f inputA(-3.3f, 2.2f, 8.8f);
	Vector3f inputB(-5.0f, 7.0f, 18.0f);
	Vector3f inputC(6.6f, 43.43f, -12.12f);
	
	float expected = 670.274f;
	float largeDelta = 0.0002f;
	float smallDelta = 0.000005f;
	
	float actual = Vector3f::determinant(inputA, inputB, inputC);
	
	CPPUNIT_ASSERT_DOUBLES_EQUAL(expected, actual, largeDelta);
	CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL(expected, actual, smallDelta) );
}
Esempio n. 12
0
void Vector3fTest::testLengthInverse()
{
	Vector3f inputA(-3.3f, 2.2f, 8.8f);
	
	float expectedA = 0.103600524f;
	float largeDelta = 0.0002f;
	float smallDelta = 0.000005f;
	
	float actualA = inputA.length_inverse();
	
	CPPUNIT_ASSERT_DOUBLES_EQUAL(expectedA, actualA, largeDelta);
	CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL(expectedA, actualA, smallDelta) );
	
	Vector3f inputB;
	
	float expectedB = 0.0f;
	
	float actualB = inputB.length_inverse();
	
	CPPUNIT_ASSERT_EQUAL(expectedB, actualB);
}
Esempio n. 13
0
void 
TestAssertTest::testAssertDoubleNonFinite()
{
  double inf = std::numeric_limits<double>::infinity();
  double nan = std::numeric_limits<double>::quiet_NaN();
  // test our portable floating-point primitives that detect NaN values
  CPPUNIT_ASSERT( CPPUNIT_NS::floatingPointIsUnordered( nan ) );
  CPPUNIT_ASSERT( !CPPUNIT_NS::floatingPointIsUnordered( inf ) );
  CPPUNIT_ASSERT( !CPPUNIT_NS::floatingPointIsUnordered( -inf ) );
  CPPUNIT_ASSERT( !CPPUNIT_NS::floatingPointIsUnordered( 1.0 ) );
  CPPUNIT_ASSERT( !CPPUNIT_NS::floatingPointIsUnordered( 1.5 ) );
  CPPUNIT_ASSERT( !CPPUNIT_NS::floatingPointIsUnordered( 2.0 ) );
  CPPUNIT_ASSERT( !CPPUNIT_NS::floatingPointIsUnordered( 2.5 ) );
  CPPUNIT_ASSERT( !CPPUNIT_NS::floatingPointIsUnordered( 0.0 ) );
  CPPUNIT_ASSERT( !CPPUNIT_NS::floatingPointIsUnordered( -1.0 ) );
  CPPUNIT_ASSERT( !CPPUNIT_NS::floatingPointIsUnordered( -2.0 ) );
  // test our portable floating-point primitives that detect finite values
  CPPUNIT_ASSERT( CPPUNIT_NS::floatingPointIsFinite( 0.0 ) );
  CPPUNIT_ASSERT( CPPUNIT_NS::floatingPointIsFinite( 0.5 ) );
  CPPUNIT_ASSERT( CPPUNIT_NS::floatingPointIsFinite( 1.0 ) );
  CPPUNIT_ASSERT( CPPUNIT_NS::floatingPointIsFinite( 1.5 ) );
  CPPUNIT_ASSERT( CPPUNIT_NS::floatingPointIsFinite( 2.0 ) );
  CPPUNIT_ASSERT( CPPUNIT_NS::floatingPointIsFinite( 2.5 ) );
  CPPUNIT_ASSERT( CPPUNIT_NS::floatingPointIsFinite( -1.5 ) );
  CPPUNIT_ASSERT( !CPPUNIT_NS::floatingPointIsFinite( nan ) );
  CPPUNIT_ASSERT( !CPPUNIT_NS::floatingPointIsFinite( inf ) );
  CPPUNIT_ASSERT( !CPPUNIT_NS::floatingPointIsFinite( -inf ) );
  // Infinity tests
  CPPUNIT_ASSERT( inf == inf );
  CPPUNIT_ASSERT( -inf == -inf );
  CPPUNIT_ASSERT( -inf != inf );
  CPPUNIT_ASSERT( -inf < inf );
  CPPUNIT_ASSERT( inf > -inf );
  CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( inf, 0.0, 1.0 ) );
  CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, inf, 1.0 ) );
  CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_DOUBLES_EQUAL( inf, inf, 1.0 ) );
  // NaN tests 
  CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( nan, 0.0, 1.0 ) );
  CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( nan, nan, 1.0 ) );
  CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( nan, inf, 1.0 ) );
  CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( inf, nan, 1.0 ) );
}