int main() {
  CHECK_EQ(false, testSingle(0));
  CHECK_EQ(false, testMultiple(0));
  CHECK_EQ(false, testVirtual(0));
  CHECK_EQ(false, testUnspecified(0));

  CHECK_EQ(true, testSingle(&Single::foo));
  CHECK_EQ(true, testMultiple(&Multiple::foo));
  CHECK_EQ(true, testVirtual(&Virtual::foo));
  CHECK_EQ(true, testUnspecified(&Unspecified::foo));

  // We only need to test the method pointer (slot 0) to know if the memptr is
  // non-null.  Full equality requires more comparisons.
  CHECK_EQ(false, testUnspecified(g_unspecified_memptr));
}
Example #2
0
int main()
{
	try
	{
		testSingle("schloss");
		
		testConcat("schloss","dagstuhl");
		testConcat("dagstuhl","schloss");
		testConcat("schloss","");
		testConcat("","schloss");
		testConcat("dagstuhl","");
		testConcat("","dagstuhl");
		testConcat("aaaaaaa","aaaaaaaaaa");
		testConcat("","aaaaaaaaaa");
		testConcat("aaaaaaa","");
		testConcat("abcdefghi","jklmnopqrs");
		testConcat("jklmnopqrs","abcdefghi");
	}
	catch(std::exception const & ex)
	{
		std::cerr << ex.what() << std::endl;
		return EXIT_FAILURE;
	}
}
Example #3
0
//==========================================================================================================================
//	Test to add data. Want to add single values to empty Stats class.
//	Then add another stat on top with weight. I will use the average to check
//	that data was added and that the data added was correct.
//==========================================================================================================================
		int AddTest()
		{
			TestUtil testFramework( "PolyFit", "Add", __FILE__, __LINE__ );
			std::string failMesg;

			int n = 4;
			gpstk::PolyFit<double> testSingle(n), testGpstkVector(n), testStdVector(n);
			double indepSingle[6] = {0, 1, 2, 3, 4, 5}, depSingle[6] = {0, 1, 8, 27, 64, 125};
			gpstk::Vector<double> indepGpstkVector(6,0.), depGpstkVector(6,0.);
			std::vector<double>   indepStdVector(6,0.)  , depStdVector(6,0.);

			for(int i=0; i<6; i++)
			{
				indepGpstkVector[i] = indepSingle[i];
				indepStdVector[i]   = indepSingle[i];	
				depGpstkVector[i]   = depSingle[i];
				depStdVector[i]     = depSingle[i];			
			}			

			//---------------------------------------------------------------------
			//Test the single entry Add
			//---------------------------------------------------------------------
			try 
			{
				//Can single values be added
				for(int i=0; i<6; i++)
				{
					testSingle.Add(depSingle[i],indepSingle[i]);
				}
				//Were all single values added successfully?
				testFramework.assert(testSingle.N() == 6, "Not all single adds were successful", __LINE__);

			}
			catch(...){testFramework.assert(false, "Exception thrown during Single add", __LINE__);}		

			//---------------------------------------------------------------------
			//Test the gpstk::Vector Add
			//---------------------------------------------------------------------
			try 
			{
				//Check that all values can be added with a gpstk::Vector
				testGpstkVector.Add(indepGpstkVector, depGpstkVector);
				testFramework.assert(testGpstkVector.N() == 6, "Not all gpstk::Vector adds were successful", __LINE__);		
			}
			catch(...){testFramework.assert(false, "Exception thrown during gpstk::Vector add", __LINE__);}	


			//---------------------------------------------------------------------
			//Test the std::vector Add
			//---------------------------------------------------------------------
			try 
			{
				//Check that all values can be added with a std::Vector
				testStdVector.Add(indepStdVector, depStdVector);
				testFramework.assert(testStdVector.N() == 6, "Not all std::vector adds were successful", __LINE__);	
			}
			catch(...){testFramework.assert(false, "Exception thrown during std::vector add", __LINE__);}	


			return testFramework.countFails();
		}