Пример #1
0
void tests() {

  typedef RxSO3Group<Scalar> RxSO3Type;
  typedef typename RxSO3Group<Scalar>::Point Point;
  typedef typename RxSO3Group<Scalar>::Tangent Tangent;

  vector<RxSO3Type> rxso3_vec;
  rxso3_vec.push_back(RxSO3Type::exp(Tangent(0.2, 0.5, 0.0, 1.)));
  rxso3_vec.push_back(RxSO3Type::exp(Tangent(0.2, 0.5, -1.0, 1.1)));
  rxso3_vec.push_back(RxSO3Type::exp(Tangent(0., 0., 0., 1.1)));
  rxso3_vec.push_back(RxSO3Type::exp(Tangent(0., 0., 0.00001, 0.)));
  rxso3_vec.push_back(RxSO3Type::exp(Tangent(0., 0., 0.00001, 0.00001)));
  rxso3_vec.push_back(RxSO3Type::exp(Tangent(0., 0., 0.00001, 0)));
  rxso3_vec.push_back(RxSO3Type::exp(Tangent(M_PI, 0, 0, 0.9)));
  rxso3_vec.push_back(RxSO3Type::exp(Tangent(0.2, 0.5, 0.0,0))
                      *RxSO3Type::exp(Tangent(M_PI, 0, 0,0.0))
                      *RxSO3Type::exp(Tangent(-0.2, -0.5, -0.0,0)));
  rxso3_vec.push_back(RxSO3Type::exp(Tangent(0.3, 0.5, 0.1,0))
                      *RxSO3Type::exp(Tangent(M_PI, 0, 0,0))
                      *RxSO3Type::exp(Tangent(-0.3, -0.5, -0.1,0)));

  vector<Tangent> tangent_vec;
  Tangent tmp;
  tmp << 0,0,0,0;
  tangent_vec.push_back(tmp);
  tmp << 1,0,0,0;
  tangent_vec.push_back(tmp);
  tmp << 1,0,0,0.1;
  tangent_vec.push_back(tmp);
  tmp << 0,1,0,0.1;
  tangent_vec.push_back(tmp);
  tmp << 0,0,1,-0.1;
  tangent_vec.push_back(tmp);
  tmp << -1,1,0,-0.1;
  tangent_vec.push_back(tmp);
  tmp << 20,-1,0,2;
  tangent_vec.push_back(tmp);

  vector<Point> point_vec;
  point_vec.push_back(Point(1,2,4));

  Tests<RxSO3Type> tests;
  tests.setGroupElements(rxso3_vec);
  tests.setTangentVectors(tangent_vec);
  tests.setPoints(point_vec);

  tests.runAllTests();
}
Пример #2
0
int
main(int argc, const char **argv)
{
	set_debug_flags(NULL, D_ALWAYS);

	set_mySubSystem( "TEST_LEASE_MANAGER", SUBSYSTEM_TYPE_TOOL );

		// initialize to read from config file
	myDistro->Init( argc, argv );
	config();

		// Set up the dprintf stuff...
	dprintf_set_tool_debug("TEST_LEASE_MANAGER", 0);

	int		status;
	status = tests.CmdLine( argc, argv );
	if ( status < 0 ) {
		fprintf(stderr, "Error processing command line\n" );
		exit( 1 );
	}
	else if ( status > 0 ) {
		exit( 0 );
	}

	// Install handlers
	signal( SIGINT, handle_sig );
	signal( SIGTERM, handle_sig );

	status = Tests.Run( );

	exit( 0 );
}
Пример #3
0
//
//   FUNCTION: InitInstance(HINSTANCE, int)
//
//   PURPOSE: Saves instance handle and creates main window
//
//   COMMENTS:
//
//        In this function, we save the instance handle in a global variable and
//        create and display the main program window.
//
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
   HWND hWnd;

   hInst = hInstance; // Store instance handle in our global variable

#if defined(ZOOM) && defined(SECOND_SCREEN)
   hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
	1920 + 0, 0, 1920, 1000, NULL, NULL, hInstance, NULL);
#elif defined(ZOOM) && !defined(SECOND_SCREEN)
    hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
      0, 0, 1920, 1000, NULL, NULL, hInstance, NULL);
#elif !defined(ZOOM) && defined(SECOND_SCREEN)
    hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
      1920 + 296, 266, 1296, 538, NULL, NULL, hInstance, NULL);
#else
    hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
      296, 266, 1296, 538, NULL, NULL, hInstance, NULL);
#endif

   if (!hWnd)
   {
      return FALSE;
   }

   ShowWindow(hWnd, nCmdShow);
   UpdateWindow(hWnd);

   // Run the Pi tests
   Tests tests;
   tests.RunAllTests();

  // while(1);

   LoadFontResource(&gFontErasDemi18, "Eras Demi ITC.bin");
   LoadImageResource(&gWaterTempImage, "..\\..\\bitmaps\\Water.bmp");
   LoadImageResource(&gFuelImage, "..\\..\\bitmaps\\Fuel.bmp");
   LoadImageResource(&gCarTopView, "..\\..\\bitmaps\\CamaroGrey.bmp");
   LoadImageResource(&gLeftArrowImage, "..\\..\\bitmaps\\LeftArrow.bmp");
   LoadImageResource(&gRightArrowImage, "..\\..\\bitmaps\\RightArrow.bmp");
   
   Rect rect(0, 0, 1280, 480);
   gCluster.Init(rect);
   gFontDB.CreateFontDatabase("Eras Demi ITC", 18);

   return TRUE;
}
Пример #4
0
void tests() {

  typedef SO2Group<Scalar> SO2Type;
  typedef SE2Group<Scalar> SE2Type;
  typedef typename SE2Group<Scalar>::Point Point;
  typedef typename SE2Group<Scalar>::Tangent Tangent;

  vector<SE2Type, Eigen::aligned_allocator<SE2Type> > se2_vec;
  se2_vec.push_back(SE2Type(SO2Type(0.0),Point(0,0)));
  se2_vec.push_back(SE2Type(SO2Type(0.2),Point(10,0)));
  se2_vec.push_back(SE2Type(SO2Type(0.),Point(0,100)));
  se2_vec.push_back(SE2Type(SO2Type(-1.),Point(20,-1)));
  se2_vec.push_back(SE2Type(SO2Type(0.00001),
                            Point(-0.00000001,0.0000000001)));
  se2_vec.push_back(SE2Type(SO2Type(0.2),Point(0,0))
                    *SE2Type(SO2Type(M_PI),Point(0,0))
                    *SE2Type(SO2Type(-0.2),Point(0,0)));
  se2_vec.push_back(SE2Type(SO2Type(0.3),Point(2,0))
                    *SE2Type(SO2Type(M_PI),Point(0,0))
                    *SE2Type(SO2Type(-0.3),Point(0,6)));

  vector<Tangent, Eigen::aligned_allocator<Tangent> > tangent_vec;
  Tangent tmp;
  tmp << 0,0,0;
  tangent_vec.push_back(tmp);
  tmp << 1,0,0;
  tangent_vec.push_back(tmp);
  tmp << 0,1,1;
  tangent_vec.push_back(tmp);
  tmp << -1,1,0;
  tangent_vec.push_back(tmp);
  tmp << 20,-1,-1;
  tangent_vec.push_back(tmp);
  tmp << 30,5,20;
  tangent_vec.push_back(tmp);

  vector<Point, Eigen::aligned_allocator<Point> > point_vec;
  point_vec.push_back(Point(1,2));

  Tests<SE2Type> tests;
  tests.setGroupElements(se2_vec);
  tests.setTangentVectors(tangent_vec);
  tests.setPoints(point_vec);

  tests.runAllTests();
}
Q_DECL_EXPORT int main(int argc, char *argv[])
{
    QScopedPointer<QApplication> app(createApplication(argc, argv));

    qDebug() << "root path: " << Sbs2Common::setDefaultRootAppPath();
    qDebug() << "catalog path: " << Sbs2Common::setDefaultCatalogPath();

    MyCallback* myCallback = new MyCallback();
    Sbs2EmotivDataReader* sbs2DataReader = Sbs2EmotivDataReader::New(myCallback);

    Tests* tests = new Tests();
    tests->run();

    QmlApplicationViewer viewer;
    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
    viewer.setMainQmlFile(QLatin1String("qml/sbs2-Test/main.qml"));
    viewer.showExpanded();

    return app->exec();
}
Пример #6
0
int main(int argc, char* argv[]) {

	Tests tests;
	cl_float sparsefactor[] = { 0.001, 0.01, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6 };
	int numInstances = 500;
	int reps = 50;
	int nsparse = sizeof(sparsefactor) / sizeof(cl_float);
	//tests.standard_single(200, 0.8, true);
	//tests.grid_single(50, 0.65, false);

	
	cl_ulong nnodosarray[] = {50, 100, 200, 500};
	int instances[] = {10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 125, 150, 175, 200};
	int numElems = sizeof(sparsefactor) / sizeof(cl_float);


	tests.test_alltimes_CPU(500, reps, sparsefactor, numElems, true);
	

	/*
	cl_ulong nnodosarray[] = { 10, 20, 40, 100, 200, 400};
	int numElems = sizeof(nnodosarray) / sizeof(cl_ulong);

	for (int i = 0; i < numElems; i++) {
		cout << i << endl;
		tests.grid_blockfactor(nnodosarray[i], 1, false);
	}
	*/
	
	//tests.standard_sparsefactor(400, 5, false);



	return 0;

}
Пример #7
0
int main() {
	int success = 0;
	int failed = 0;
	int result;

	for (std::vector<TestCase*>::iterator test = t.tests.begin(); test != t.tests.end(); test++) {
		std::cout << "Test: " << (*test)->name;
		result = (*test)->run();
		if (result) {
			failed++;
			std::cout << " (failed)." << std::endl;
		} else {
			success++;
			std::cout << " (ok)." << std::endl;
		}
	}

	// Print summary
	std::cout << std::endl;
	std::cout << "Summary (" << t.size() << " tests):" << std::endl;
	std::cout << "Success: " << success << " Failed: " << failed << std::endl;
}
void CppToolsPlugin::test_typehierarchy_data()
{
    QTest::addColumn<QList<TestDocument> >("documents");
    QTest::addColumn<QString>("expectedHierarchy");

    QTest::newRow("basic-single-document")
        << (QList<TestDocument>()
            << TestDocument("a.h",
                            "class A {};\n"
                            "class B : public A {};\n"
                            "class C1 : public B {};\n"
                            "class C2 : public B {};\n"
                            "class D : public C1 {};\n"))
        << QString::fromLatin1(
            "A\n"
            "  B\n"
            "    C1\n"
            "      D\n"
            "    C2\n" );

    QTest::newRow("basic-multiple-documents")
        << (QList<TestDocument>()
            << TestDocument("a.h",
                            "class A {};")
            << TestDocument("b.h",
                            "#include \"a.h\"\n"
                            "class B : public A {};")
            << TestDocument("c1.h",
                            "#include \"b.h\"\n"
                            "class C1 : public B {};")
            << TestDocument("c2.h",
                            "#include \"b.h\"\n"
                            "class C2 : public B {};")
            << TestDocument("d.h",
                            "#include \"c1.h\"\n"
                            "class D : public C1 {};"))
        << QString::fromLatin1(
            "A\n"
            "  B\n"
            "    C1\n"
            "      D\n"
            "    C2\n"
            );
}
Пример #9
0
void handle_sig(int /*sig*/ )
{
	printf( "Got signal; shutting down\n" );
	tests.Shutdown( );
}
Пример #10
0
bool Tests::runTests()
{
    Tests tests;
    std::cout << "Default Constructor Test" << std::endl;
    if (!tests.defaultConstructorTest())
    {
        std::cout << "Failed Default Constructor Test" << std::endl;
        tests.updateFailCounter();
    }
    if (!tests.stringPassedByReferenceConstructorTest())
    {
        std::cout << "Failed Constructor passed by Reference Test" << std::endl;
        tests.updateFailCounter();
    }
    if (!tests.getTest())
    {
        std::cout << "Failed get() Test" << std::endl;
        tests.updateFailCounter();
    }
    std::cout << "Dereference Operator Test 1" << std::endl;
    if (!tests.dereferenceOperatorTest1())
    {
        std::cout << "Failed Dereference Operator Test 1" << std::endl;
        tests.updateFailCounter();
    }
    if (!tests.dereferenceOperatorTest2())
    {
        std::cout << "Failed Dereference Operator Test 2" << std::endl;
        tests.updateFailCounter();
    }
    if (!tests.dereferenceOperatorTest3())
    {
        std::cout << "Failed Dereference Operator Test 3" << std::endl;
        tests.updateFailCounter();
    }
    std::cout << "Dereference Member Test 1" << std::endl;
    if (!tests.dereferenceObjectMemberTest1())
    {
        std::cout << "Failed Dereference Member Test" << std::endl;
        tests.updateFailCounter();
    }
    std::cout << "Dereference Member Test 2" << std::endl;
    if (!tests.dereferenceObjectMemberTest2())
    {
        std::cout << "Failed Dereference Member Test" << std::endl;
        tests.updateFailCounter();
    }
    std::cout << "Pointer Constructor Test" << std::endl;
    if (!tests.pointerConstructorTest())
    {
        std::cout << "Failed Pointer Constructor Test" << std::endl;
        tests.updateFailCounter();
    }
    std::cout << "Simple Copy Constructor Test" << std::endl;
    if (!tests.simpleCopyConstructorTest())
    {
        std::cout << "Failed Simple Copy Constructor Test" << std::endl;
        tests.updateFailCounter();
    }
    std::cout << "Unique Pointer Test 1" << std::endl;
    if (!tests.uniqueTest1())
    {
        std::cout << "Failed Unique Pointer Test 1" << std::endl;
        tests.updateFailCounter();
    }
    std::cout << "Unique Pointer Test 2" << std::endl;
    if (!tests.uniqueTest2())
    {
        std::cout << "Failed Unique Pointer Test 2" << std::endl;
        tests.updateFailCounter();
    }
    std::cout << "Unique Pointer Test 3" << std::endl;
    if (!tests.uniqueTest3())
    {
        std::cout << "Failed Unique Pointer Test 3" << std::endl;
        tests.updateFailCounter();
    }
    std::cout << "Complex Copy Constructor Test" << std::endl;
    if (!tests.complexCopyConstructorTest())
    {
        std::cout << "Failed Complex Copy Constructor Test" << std::endl;
        tests.updateFailCounter();
    }
    std::cout << "Assignment Operator Test 1" << std::endl;
    if (!tests.assignmentOperatorTest1())
    {
        std::cout << "Failed Assignment Operator Test 1" << std::endl;
        tests.updateFailCounter();
    }
    std::cout << "Assignment Operator Test 2" << std::endl;
    if (!tests.assignmentOperatorTest2())
    {
        std::cout << "Failed Assignment Operator Test 2" << std::endl;
        tests.updateFailCounter();
    }
    std::cout << "Assignment Operator Test 3" << std::endl;
    if (!tests.assignmentOperatorTest3())
    {
        std::cout << "Failed Assignment Operator Test 3" << std::endl;
        tests.updateFailCounter();
    }
    std::cout << "Reset Test 1" << std::endl;
    if (!tests.resetTest1())
    {
        std::cout << "Failed Reset Test 1" << std::endl;
        tests.updateFailCounter();
    }
    if (!tests.resetTest2())
    {
        std::cout << "Failed Reset Test 2" << std::endl;
        tests.updateFailCounter();
    }
    if (!tests.boolOperatorTest1())
    {
        std::cout << "Failed bool Operator Test 1" << std::endl;
        tests.updateFailCounter();
    }
    std::cout << "bool Operator Test 2" << std::endl;
    if (!tests.boolOperatorTest2())
    {
        std::cout << "Failed bool Operator Test 2" << std::endl;
        tests.updateFailCounter();
    }
    if (!tests.failedTests())
    {
        std::cout << "Well done on finishing the last coding exercise for INFO3220" << std::endl;
        return true;
    }
    return false;
}
Пример #11
0
/**
 * @brief Runs structure0815
 */
int main(int argc, char **argv)
{
  STRUCTURE_INFO("Starting Structure0815");

  if (argc != 2){
    STRUCTURE_INFO("Usage: ./structure0815 configurationFileName/tests");
    abort();
  }
  std::string configFileName(argv[1]);

  if (configFileName == std::string("tests")){
    Tests tests;
    tests.run();
    return 1;
  }

  std::string meshName("WetSurface");

  SolverInterface cplInterface("Structure0815", 0, 1);
  cplInterface.configure(configFileName);
  double dt = cplInterface.initialize();

  std::string writeCheckpoint(constants::actionWriteIterationCheckpoint());
  std::string readCheckpoint(constants::actionReadIterationCheckpoint());

  int dimensions = cplInterface.getDimensions();
  double density = 500.0;
  DynVector gravity (dimensions, 0.0); //-9.81;
  gravity(1) = -9.81;

  STRUCTURE_INFO("Density = " << density);
  STRUCTURE_INFO("Gravity = " << gravity);

  if ( not cplInterface.hasMesh(meshName) ){
    STRUCTURE_INFO("Mesh \"" << meshName << "\" required for coupling!");
    exit(-1);
  }
  MeshHandle handle = cplInterface.getMeshHandle(meshName);

  int velocitiesID = -1;
  int forcesID = -1;
  int displacementsID = -1;
  int displDeltasID = -1;
  int velocityDeltasID = -1;

  if (not cplInterface.hasData(constants::dataForces())){
    STRUCTURE_INFO("Data \"Forces\" required for coupling!");
    exit(-1);
  }
  forcesID = cplInterface.getDataID(constants::dataForces());
  if (cplInterface.hasData(constants::dataVelocities())){
    velocitiesID = cplInterface.getDataID(constants::dataVelocities());
  }
  if (cplInterface.hasData(constants::dataDisplacements())){
    displacementsID = cplInterface.getDataID(constants::dataDisplacements());
  }
  if (cplInterface.hasData("DisplacementDeltas")){
    displDeltasID = cplInterface.getDataID("DisplacementDeltas");
  }
  if (cplInterface.hasData("VelocityDeltas")){
    velocityDeltasID = cplInterface.getDataID("VelocityDeltas");
  }

  DynVector nodes(handle.vertices().size()*dimensions);
  tarch::la::DynamicVector<int> faces;
  size_t iVertex = 0;
  VertexHandle vertices = handle.vertices();
  foriter (VertexIterator, it, vertices){
    for (int i=0; i < dimensions; i++){
      nodes[iVertex*dimensions+i] = it.vertexCoords()[i];
    }
    iVertex++;
  }
  if (dimensions == 2){
    faces.append(handle.edges().size()*2, 0);
    EdgeHandle edges = handle.edges();
    int iEdge = 0;
    foriter (EdgeIterator, it, edges){
      for (int i=0; i < 2; i++){
        faces[iEdge*2+i] = it.vertexID(i);
      }
      iEdge++;
    }
  }
Пример #12
0
int wmain(int argc, wchar_t **argv) {
	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF);

	wprintf(L"VirtualDub test harness utility for " BUILD L"\n");
	wprintf(L"Copyright (C) 2005-2008 Avery Lee. Licensed under GNU General Public License\n\n");

	Tests selectedTests;

	if (argc <= 1) {
		help();
		exit(0);
	} else {
		for(int i=1; i<argc; ++i) {
			const wchar_t *test = argv[i];

			if (!_wcsicmp(test, L"all")) {
				for(Tests::const_iterator it(g_tests.begin()), itEnd(g_tests.end()); it!=itEnd; ++it) {
					const TestInfo& ent = *it;

					if (ent.mbAutoRun)
						selectedTests.push_back(ent);
				}
				break;
			}

			for(Tests::const_iterator it(g_tests.begin()), itEnd(g_tests.end()); it!=itEnd; ++it) {
				const TestInfo& ent = *it;

				if (!_wcsicmp(VDTextAToW(ent.mpName).c_str(), test)) {
					selectedTests.push_back(ent);
					goto next;
				}
			}

			wprintf(L"\nUnknown test: %ls\n", test);
			help();
			exit(5);
next:
			;
		}
	}

	long exts = CPUCheckForExtensions();
	int failedTests = 0;

	for(;;) {
		CPUEnableExtensions(exts);
		wprintf(L"Setting CPU extensions: %08x\n", exts);

		for(Tests::const_iterator it(selectedTests.begin()), itEnd(selectedTests.end()); it!=itEnd; ++it) {
			const Tests::value_type& ent = *it;

			wprintf(L"Running test: %hs\n", ent.mpName);

			try {
				ent.mpTestFn();
			} catch(const AssertionException& e) {
				wprintf(L"    TEST FAILED: %hs\n", e.gets());
				++failedTests;
			}
		}

		if (!exts)
			break;

		exts &= ~(1 << VDFindHighestSetBitFast(exts));
	}

	return failedTests;
}
Пример #13
0
/**
 * When the test is declared it adds itself to the list
 */
TestCase::TestCase(std::string n, int (*f)()) {
	name = n;
	run = f;
	t.register_test(this);
}