Пример #1
0
void xPolyFit :: constrTest (void)
{
	try
	{
	CPPUNIT_ASSERT_NO_THROW(gpstk::PolyFit<double> PolyCheck);
	CPPUNIT_ASSERT_NO_THROW(gpstk::PolyFit<double> PolyNumCheck(4));
	
	gpstk::PolyFit<double> Poly;
	CPPUNIT_ASSERT_EQUAL((unsigned) 0, Poly.N());
	CPPUNIT_ASSERT_EQUAL((unsigned) 0, Poly.Degree());
	CPPUNIT_ASSERT_EQUAL(true, Poly.isSingular());
	gpstk::PolyFit<double> Poly4((unsigned) 4);
	CPPUNIT_ASSERT_EQUAL((unsigned) 0, Poly4.N());
	CPPUNIT_ASSERT_EQUAL((unsigned) 4, Poly4.Degree());
	CPPUNIT_ASSERT_EQUAL(true, Poly4.isSingular());
	}
	catch (gpstk::Exception& e)
	{
	cout << e;
	}
}
Пример #2
0
//==========================================================================================================================
//	constructorTest ensures the constructors set the object properly
//==========================================================================================================================
		int constructorTest(void)
		{
			TestUtil testFramework( "PolyFit", "Constructor", __FILE__, __LINE__ );
			try
			{
				//---------------------------------------------------------------------
				//Test the default constructor
				//---------------------------------------------------------------------
				try
				{
					gpstk::PolyFit<double> PolyCheck;
					testFramework.assert(true, "Default constructor successfully built a PolyFit object", __LINE__);
				}
				catch(...){testFramework.assert(false, "Unexpected exception thrown during default construction of a PolyFit object", __LINE__); }
				gpstk::PolyFit<double> Poly;
				testFramework.assert((unsigned) 0 == Poly.N()     , "Default constructor created an object with data in it"    , __LINE__);
				testFramework.assert((unsigned) 0 == Poly.Degree(), "Default constructor allows for non-constant fits"         , __LINE__);
				testFramework.assert(Poly.isSingular()            , "The fit found after default construction was not singular", __LINE__);

				//---------------------------------------------------------------------
				//Test the explicit constructor
				//---------------------------------------------------------------------
				try
				{
					gpstk::PolyFit<double> PolyCheck(4);
					testFramework.assert(true, "Explicit constructor successfully built a PolyFit object", __LINE__);
				}
				catch(...){testFramework.assert(false, "Unexpected exception thrown during explicit construction of a PolyFit object", __LINE__); }
				gpstk::PolyFit<double> Poly4((unsigned) 4);
				testFramework.assert((unsigned) 0 == Poly4.N()     , "Explicit constructor created an object with data in it"            , __LINE__);
				testFramework.assert((unsigned) 4 == Poly4.Degree(), "Explicit constructor does not fit polynomials of the correct order", __LINE__);
				testFramework.assert(Poly4.isSingular()            , "The fit found after explicit construction was not singular"        , __LINE__);
			}
			catch (gpstk::Exception& e) {}

			return testFramework.countFails();
		}