예제 #1
0
파일: main.cpp 프로젝트: chiehwen/djondb
// Main test program
//
int main(int argc, char* argv[])
{
	try
	{
		// Demonstrates the ability to use multiple test suites
		//
		Test::Suite ts;
		ts.add(auto_ptr<Test::Suite>(new TestBSONSuite));
		//        ts.add(auto_ptr<Test::Suite>(new CompareTestSuite));
		//        ts.add(auto_ptr<Test::Suite>(new ThrowTestSuite));

		// Run the tests
		//
		auto_ptr<Test::Output> output(cmdline(argc, argv));
		ts.run(*output, true);

		Test::HtmlOutput* const html = dynamic_cast<Test::HtmlOutput*>(output.get());
		if (html)
			html->generate(cout, true, "MyTest");
	}
	catch (...)
	{
		cout << "unexpected exception encountered\n";
		return EXIT_FAILURE;
	}
	return EXIT_SUCCESS;
}
예제 #2
0
void Testrunner::RunTests() {
	Test::Suite ts;
	ts.add(auto_ptr<Test::Suite> (new RequestSuite));

	Test::HtmlOutput *out = new Test::HtmlOutput();
	Test::TextOutput *textout = new Test::TextOutput(Test::TextOutput::Verbose,
			cout);

	//	out->Output();

	//ts.run(*out, true);

	ts.run(*textout, true);
	//ofstream* file = new std::ofstream();
	string timestr;
	timestr = GetCurrentTime();
	for (unsigned int i = 0; i < timestr.length(); i++) {
		if (timestr[i] == ' ' || timestr[i] == ':')
			timestr[i] = '_';
	}
	//string filename = "results/test_"+ timestr + ".html";
	//file->open(filename.c_str() , ios::out);

	//out->generate(*file, true, "MyHTTPD Tests");
	//file->close();

	//delete file;
	delete textout;
	delete out;
}
예제 #3
0
int main( int argc, char **argv)
{
    Test::Suite ts;
    ts.add(std::auto_ptr<Test::Suite>(new SensorTest));
    ts.add(std::auto_ptr<Test::Suite>(new ProtocolTest));

    Test::TextOutput output(Test::TextOutput::Verbose);
    return !ts.run(output);
}
예제 #4
0
bool run_tests()
{
    // Add desired suites to parent suite
    Test::Suite ts;
    ts.add(std::auto_ptr<Test::Suite>(new APITestSuite));    //This line can be copied to add new test suites
    ts.add(std::auto_ptr<Test::Suite>(new APITestSuiteVSPAERO));

    // Test Suite run parameters
    Test::TextOutput output(Test::TextOutput::Verbose);
    bool cont_after_fail = true; //TRUE continues test execution after failure

    // Run the test and return success or failure
    return ts.run(output, cont_after_fail) ? EXIT_SUCCESS : EXIT_FAILURE;
}
예제 #5
0
파일: KSciTest.cpp 프로젝트: rhli/kl1p-test
bool KSciTest::run()
{
    Test::Suite tests;
    
    tests.add(std::auto_ptr<Test::Suite>(new KMathsUtilUnitTest()));   
	tests.add(std::auto_ptr<Test::Suite>(new KTrigoUtilUnitTest()));  
	tests.add(std::auto_ptr<Test::Suite>(new KComplexUnitTest()));  
    tests.add(std::auto_ptr<Test::Suite>(new KArmadilloTest())); 
    tests.add(std::auto_ptr<Test::Suite>(new KArmadilloUtilUnitTest()));      
    tests.add(std::auto_ptr<Test::Suite>(new KMatrixLinearOperatorUnitTest())); 
    tests.add(std::auto_ptr<Test::Suite>(new KComplexProxyLinearOperatorUnitTest()));
    tests.add(std::auto_ptr<Test::Suite>(new KLeastSquareSystemSolverUnitTest())); 
    tests.add(std::auto_ptr<Test::Suite>(new KConjugateGradientSystemSolverUnitTest())); 
    tests.add(std::auto_ptr<Test::Suite>(new KDFT1DUnitTest())); 
    tests.add(std::auto_ptr<Test::Suite>(new KDFT2DUnitTest())); 
    tests.add(std::auto_ptr<Test::Suite>(new KFFT1DUnitTest())); 
    tests.add(std::auto_ptr<Test::Suite>(new KFFT2DUnitTest()));
    tests.add(std::auto_ptr<Test::Suite>(new KDWT1DUnitTest())); 
    tests.add(std::auto_ptr<Test::Suite>(new KDWT2DUnitTest()));
    tests.add(std::auto_ptr<Test::Suite>(new KFWT1DUnitTest())); 
    tests.add(std::auto_ptr<Test::Suite>(new KFWT2DUnitTest())); 
    tests.add(std::auto_ptr<Test::Suite>(new KDWHT1DUnitTest())); 
    tests.add(std::auto_ptr<Test::Suite>(new KDWHT2DUnitTest()));
    tests.add(std::auto_ptr<Test::Suite>(new KFWHT1DUnitTest())); 
    tests.add(std::auto_ptr<Test::Suite>(new KFWHT2DUnitTest()));     
    tests.add(std::auto_ptr<Test::Suite>(new KDCT1DUnitTest()));
    tests.add(std::auto_ptr<Test::Suite>(new KDCT2DUnitTest()));
    tests.add(std::auto_ptr<Test::Suite>(new KFCT1DUnitTest()));
    tests.add(std::auto_ptr<Test::Suite>(new KFCT2DUnitTest()));
    tests.add(std::auto_ptr<Test::Suite>(new KThresholdedCountFilter1DUnitTest())); 
    tests.add(std::auto_ptr<Test::Suite>(new KThresholdedCountFilter2DUnitTest())); 
    tests.add(std::auto_ptr<Test::Suite>(new KSignalUtilUnitTest())); 
    tests.add(std::auto_ptr<Test::Suite>(new KGaussUtilUnitTest())); 
    tests.add(std::auto_ptr<Test::Suite>(new KGaussianFilter1DUnitTest())); 
    tests.add(std::auto_ptr<Test::Suite>(new KGaussianFilter2DUnitTest())); 
    tests.add(std::auto_ptr<Test::Suite>(new KGaussWienerFilter1DUnitTest())); 
    tests.add(std::auto_ptr<Test::Suite>(new KGaussWienerFilter2DUnitTest())); 
    tests.add(std::auto_ptr<Test::Suite>(new KVector2DUnitTest())); 
    tests.add(std::auto_ptr<Test::Suite>(new KVector3DUnitTest())); 
    tests.add(std::auto_ptr<Test::Suite>(new KLinearInterpolationFilterUnitTest()));
	tests.add(std::auto_ptr<Test::Suite>(new KCubicInterpolationFilterUnitTest()));
    tests.add(std::auto_ptr<Test::Suite>(new KInterpolator1DUnitTest()));
    tests.add(std::auto_ptr<Test::Suite>(new KBilinearInterpolationFilterUnitTest()));
	tests.add(std::auto_ptr<Test::Suite>(new KBicubicInterpolationFilterUnitTest()));
    
    Test::TextOutput output(Test::TextOutput::Verbose);
    return tests.run(output);
}
예제 #6
0
// Main test program
//
int
main(int argc, char* argv[])
{
	/*
    try
	{
    */
		// Demonstrates the ability to use multiple test suites
		//
		Test::Suite ts;
        // Utility tests
		ts.add(auto_ptr<Test::Suite>(new StringUtilsTestSuite));
        // Graphical tests
		ts.add(auto_ptr<Test::Suite>(new RectTestSuite));
		ts.add(auto_ptr<Test::Suite>(new BezierPathTestSuite));
		ts.add(auto_ptr<Test::Suite>(new PathElementTestSuite));
		ts.add(auto_ptr<Test::Suite>(new ImageTestSuite));
		ts.add(auto_ptr<Test::Suite>(new CanvasTestSuite));
        // Node tests
		ts.add(auto_ptr<Test::Suite>(new NodeTestSuite));
		ts.add(auto_ptr<Test::Suite>(new ParameterTestSuite));
		ts.add(auto_ptr<Test::Suite>(new ConnectTestSuite));
		ts.add(auto_ptr<Test::Suite>(new NetworkTestSuite));
		ts.add(auto_ptr<Test::Suite>(new CanvasNodeTestSuite));

		// Run the tests
		//
		auto_ptr<Test::Output> output(cmdline(argc, argv));
		if (ts.run(*output, true))
		{
			Test::HtmlOutput* html = dynamic_cast<Test::HtmlOutput*>(output.get());
			if (html)
				html->generate(cout, true, "MyTest");
		}
	/*
    }
	catch (...)
	{
		cout << "unexpected exception encountered\n";
		return EXIT_FAILURE;
	}
    */
	return EXIT_SUCCESS;
}
예제 #7
0
int main()
{
  Test::Suite ts;
  
  #pragma clang diagnostic ignored "-Wdeprecated-declarations"
  ts.add(std::auto_ptr<Test::Suite>(new TestSuite_TYPES_3D));
  ts.add(std::auto_ptr<Test::Suite>(new TestSuite_COLLISIONS));
  
  //Test::TextOutput output(Test::TextOutput::Verbose);
  Test::HtmlOutput output;

  // run the tests
  auto result = ts.run(output);
  
  std::ofstream f;
  f.open("results.html");
  //output.generate(std::cout, true, "MyTest"); // can output directly to terminal
  output.generate(f, true, "Octree");

  return result;
}
예제 #8
0
int main(int argc, char *argv[])
{
  Test::Output *pout;
  TestType tt(testTypeCompiler);
  int rtn(EXIT_SUCCESS);

  // if user passed command line argument then parse it
  if (argc==1)
  {
    tt=testTypeCompiler;
  }
  else if (argc==2)
  {
    size_t lenargv(strlen(argv[1]));

    // using short codes
    if (lenargv==2)
    {
      if (argv[1][0]=='-')
      {
        switch(argv[1][1])
        {
          case('t'):
            tt=testTypeText;
            break;
          case('c'):
            tt=testTypeCompiler;
            break;
          case('h'):
            tt=testTypeHTML;
            break;
          default:
            std::cerr << "Unrecognized parameter: " << argv[1] << std::endl;
            rtn=EXIT_FAILURE;
            break;
        }
      }
      else
      {
        std::cerr << "Unrecognized parameter: " << argv[1] << std::endl;
        rtn=EXIT_FAILURE;
      }
    }
    else
    {
      if (lenargv==6)
      {
        if (std::strncmp(argv[1], "--text", lenargv)==0)
          tt=testTypeText;
        else if (std::strncmp(argv[1], "--html", lenargv)==0)
          tt=testTypeHTML;
        else if (std::strncmp(argv[1], "--help", lenargv)==0)
          rtn=EXIT_FAILURE;
        else
        {
          std::cerr << "Unrecognized parameter: " << argv[1] << std::endl;
          rtn=EXIT_FAILURE;
        }
      }
      else if (lenargv==10)
      {
        if (std::strncmp(argv[1], "--compiler", lenargv)==0)
          tt=testTypeCompiler;
        else
        {
          std::cerr << "Unrecognized parameter: " << argv[1] << std::endl;
          rtn=EXIT_FAILURE;
        }
      }
    }
  }
  else
  {
    std::cerr << "Can only pass one argument." << std::endl;
    rtn=EXIT_FAILURE;
  }
  if (rtn==EXIT_FAILURE)
  {
    std::cerr << "  Usage: " << argv[0] << " [--text|-t|--compiler|-c|--html|-h]" << std::endl;
    return rtn;
  }

  // allocate the correct output type
  switch (tt)
  {
    case(testTypeText):
    {
      Test::TextOutput *po = new Test::TextOutput(Test::TextOutput::Verbose);
      pout = static_cast<Test::Output *>(po);
      break;
    }
    case(testTypeCompiler):
    {
      Test::CompilerOutput *po = new Test::CompilerOutput(Test::CompilerOutput::GCC);
      pout = static_cast<Test::Output *>(po);
      break;
    }
    case(testTypeHTML):
    {
      Test::HtmlOutput *po = new Test::HtmlOutput;
      pout = static_cast<Test::Output *>(po);
      break;
    }
    default:
    {
      rtn=EXIT_FAILURE;
      break;
    }
  }

  if (rtn == EXIT_SUCCESS)
  {
    // get the current time information
    time_t rawtime;
    struct tm * timeinfo;
    std::string datetime;
    time (&rawtime);
    timeinfo = localtime(&rawtime);
    datetime = asctime(timeinfo);

    // add the test suites to the test runner
    // NOTE: This is where changes should be needed
    //
    Test::Suite ts;
    std::string ostr_filename("airfoil_test_results.html");

    // add the cppack test suites
    ts.add(std::auto_ptr<Test::Suite>(new four_digit_test_suite<float>()));
    ts.add(std::auto_ptr<Test::Suite>(new four_digit_test_suite<double>()));
    ts.add(std::auto_ptr<Test::Suite>(new four_digit_test_suite<long double>()));

    //
    // NOTE: End of section that should be changed

    // run the test
    rtn = (ts.run(*pout)) ? EXIT_SUCCESS : EXIT_FAILURE;

    // generate the html data if requested
    if (tt==testTypeHTML)
    {
      std::ofstream ostr(ostr_filename.c_str());
      Test::HtmlOutput *phtmlout=dynamic_cast<Test::HtmlOutput *>(pout);

      phtmlout->generate(ostr, true, datetime);

      ostr.close();
    }

    delete pout;
  }

  return rtn;
}
예제 #9
0
파일: utest.cpp 프로젝트: Jordan08/ibex-lib
int main() {

	Interval x(Interval::EMPTY_SET);

    Test::TextOutput output(Test::TextOutput::Verbose);

    Test::Suite ts;

    ts.add(auto_ptr<Test::Suite>(new TestString()));
    ts.add(auto_ptr<Test::Suite>(new TestBitSet()));
    ts.add(auto_ptr<Test::Suite>(new TestSymbolMap()));
    ts.add(auto_ptr<Test::Suite>(new TestPixelMap()));

    ts.add(auto_ptr<Test::Suite>(new TestInterval()));
    ts.add(auto_ptr<Test::Suite>(new TestIntervalVector()));
    ts.add(auto_ptr<Test::Suite>(new TestIntervalMatrix()));
    ts.add(auto_ptr<Test::Suite>(new TestDim()));
    ts.add(auto_ptr<Test::Suite>(new TestArith()));
    ts.add(auto_ptr<Test::Suite>(new TestInnerArith()));
    //ts.add(auto_ptr<Test::Suite>(new TestDomain()));

    ts.add(auto_ptr<Test::Suite>(new TestAffine2()));

    ts.add(auto_ptr<Test::Suite>(new TestExpr()));
    ts.add(auto_ptr<Test::Suite>(new TestExprCopy()));
    ts.add(auto_ptr<Test::Suite>(new TestExprDiff()));
    ts.add(auto_ptr<Test::Suite>(new TestExprSplitOcc()));
    ts.add(auto_ptr<Test::Suite>(new TestFunction()));
    ts.add(auto_ptr<Test::Suite>(new TestNumConstraint()));
    ts.add(auto_ptr<Test::Suite>(new TestEval()));

    ts.add(auto_ptr<Test::Suite>(new TestParser()));
    ts.add(auto_ptr<Test::Suite>(new TestSystem()));

    ts.add(auto_ptr<Test::Suite>(new TestHC4Revise()));
    ts.add(auto_ptr<Test::Suite>(new TestInHC4Revise()));
    ts.add(auto_ptr<Test::Suite>(new TestGradient()));

    ts.add(auto_ptr<Test::Suite>(new TestLinear()));
    ts.add(auto_ptr<Test::Suite>(new TestNewton()));

    ts.add(auto_ptr<Test::Suite>(new TestPdcHansenFeasibility()));

    ts.add(auto_ptr<Test::Suite>(new TestCtcHC4()));
    ts.add(auto_ptr<Test::Suite>(new TestCtcInteger()));
    ts.add(auto_ptr<Test::Suite>(new TestCtcFwdBwd()));
    ts.add(auto_ptr<Test::Suite>(new TestCtcNotIn()));
    ts.add(auto_ptr<Test::Suite>(new TestCtcExist()));
    ts.add(auto_ptr<Test::Suite>(new TestCtcForAll()));
    ts.add(auto_ptr<Test::Suite>(new TestCtcPolytopeHull()));
    ts.add(auto_ptr<Test::Suite>(new TestCtcSegment()));
    ts.add(auto_ptr<Test::Suite>(new TestCtcPixelMap()));

    ts.add(auto_ptr<Test::Suite>(new TestFritzJohn()));

    ts.add(auto_ptr<Test::Suite>(new TestOptimizer()));
    ts.add(auto_ptr<Test::Suite>(new TestSeparator()));
    ts.add(auto_ptr<Test::Suite>(new TestSepPolygon()));



    return ts.run(output,false) ? EXIT_SUCCESS : EXIT_FAILURE;

}