void test_matrix_power()
{
  CALL_SUBTEST_2(test2dRotation<double>(1e-13));
  CALL_SUBTEST_1(test2dRotation<float>(2e-5));  // was 1e-5, relaxed for clang 2.8 / linux / x86-64
  CALL_SUBTEST_9(test2dRotation<long double>(1e-13)); 
  CALL_SUBTEST_2(test2dHyperbolicRotation<double>(1e-14));
  CALL_SUBTEST_1(test2dHyperbolicRotation<float>(1e-5));
  CALL_SUBTEST_9(test2dHyperbolicRotation<long double>(1e-14));

  CALL_SUBTEST_10(test3dRotation<double>(1e-13));
  CALL_SUBTEST_11(test3dRotation<float>(1e-5));
  CALL_SUBTEST_12(test3dRotation<long double>(1e-13));

  CALL_SUBTEST_2(testGeneral(Matrix2d(),         1e-13));
  CALL_SUBTEST_7(testGeneral(Matrix3dRowMajor(), 1e-13));
  CALL_SUBTEST_3(testGeneral(Matrix4cd(),        1e-13));
  CALL_SUBTEST_4(testGeneral(MatrixXd(8,8),      2e-12));
  CALL_SUBTEST_1(testGeneral(Matrix2f(),         1e-4));
  CALL_SUBTEST_5(testGeneral(Matrix3cf(),        1e-4));
  CALL_SUBTEST_8(testGeneral(Matrix4f(),         1e-4));
  CALL_SUBTEST_6(testGeneral(MatrixXf(2,2),      1e-3)); // see bug 614
  CALL_SUBTEST_9(testGeneral(MatrixXe(7,7),      1e-13));
  CALL_SUBTEST_10(testGeneral(Matrix3d(),        1e-13));
  CALL_SUBTEST_11(testGeneral(Matrix3f(),        1e-4));
  CALL_SUBTEST_12(testGeneral(Matrix3e(),        1e-13));

  CALL_SUBTEST_2(testSingular(Matrix2d(),         1e-13));
  CALL_SUBTEST_7(testSingular(Matrix3dRowMajor(), 1e-13));
  CALL_SUBTEST_3(testSingular(Matrix4cd(),        1e-13));
  CALL_SUBTEST_4(testSingular(MatrixXd(8,8),      2e-12));
  CALL_SUBTEST_1(testSingular(Matrix2f(),         1e-4));
  CALL_SUBTEST_5(testSingular(Matrix3cf(),        1e-4));
  CALL_SUBTEST_8(testSingular(Matrix4f(),         1e-4));
  CALL_SUBTEST_6(testSingular(MatrixXf(2,2),      1e-3));
  CALL_SUBTEST_9(testSingular(MatrixXe(7,7),      1e-13));
  CALL_SUBTEST_10(testSingular(Matrix3d(),        1e-13));
  CALL_SUBTEST_11(testSingular(Matrix3f(),        1e-4));
  CALL_SUBTEST_12(testSingular(Matrix3e(),        1e-13));

  CALL_SUBTEST_2(testLogThenExp(Matrix2d(),         1e-13));
  CALL_SUBTEST_7(testLogThenExp(Matrix3dRowMajor(), 1e-13));
  CALL_SUBTEST_3(testLogThenExp(Matrix4cd(),        1e-13));
  CALL_SUBTEST_4(testLogThenExp(MatrixXd(8,8),      2e-12));
  CALL_SUBTEST_1(testLogThenExp(Matrix2f(),         1e-4));
  CALL_SUBTEST_5(testLogThenExp(Matrix3cf(),        1e-4));
  CALL_SUBTEST_8(testLogThenExp(Matrix4f(),         1e-4));
  CALL_SUBTEST_6(testLogThenExp(MatrixXf(2,2),      1e-3));
  CALL_SUBTEST_9(testLogThenExp(MatrixXe(7,7),      1e-13));
  CALL_SUBTEST_10(testLogThenExp(Matrix3d(),        1e-13));
  CALL_SUBTEST_11(testLogThenExp(Matrix3f(),        1e-4));
  CALL_SUBTEST_12(testLogThenExp(Matrix3e(),        1e-13));
}
예제 #2
0
int testMouvement(Pion& pion, int x_fin, int y_fin, Plateau plateau){
	// Je rajoute une sécurité la si ca te dérange pas.

	int x_init = pion.getPositionx();
	int y_init = pion.getPositiony();
	int proprietaire = pion.getProprietaire(); 
	
	if((x_init<9)&&(x_init>-1)&&(y_init<9)&&(y_init>-1)) 
	{
		switch(pion.getNom())
		{
			case Soldat:		//Soldat
				if(proprietaire==1)
					return testSoldat_J1(x_init,y_init,x_fin,y_fin);
				else if(proprietaire==2)
					return testSoldat_J2(x_init,y_init,x_fin,y_fin);
				break;
				
			case Chariot:		//Chariot
				if(proprietaire==1)
						return testChariot_J1(x_init,y_init,x_fin,y_fin,plateau);
					else if(proprietaire==2)
						return testChariot_J2(x_init,y_init,x_fin,y_fin,plateau);
				break;
				
			case Cavalier:		//Cavalier
				if(proprietaire==1)
					return testCavalier_J1(x_init,y_init,x_fin,y_fin);
				else if(proprietaire==2)
					return testCavalier_J2(x_init,y_init,x_fin,y_fin);
				break;
				
			case Gen_arg:		//Gen_arg
				if(proprietaire==1)
					return testGeneralArgent_J1(x_init, y_init, x_fin, y_fin);
				else if(proprietaire==2)
					return testGeneralArgent_J2(x_init, y_init, x_fin, y_fin);
				break;
				
			case Gen_or:		//Gen_or
				if(proprietaire==1)
					return testGeneralOr_J1(x_init, y_init, x_fin, y_fin);
				else if(proprietaire==2)
					return testGeneralOr_J2(x_init, y_init, x_fin, y_fin);
				break;
				
			case General:		//General
					return testGeneral(x_init, y_init, x_fin,y_fin);
				break;
				
			case Fou:		//Fou
					return testFou(x_init, y_init, x_fin,y_fin,plateau);
				break;
				
			case Tour:		//Tour
					return testTour(x_init, y_init, x_fin,y_fin,plateau);
				break;
				
			case Soldat_p:		//Soldat promu
				if(proprietaire==1)
					return testGeneralOr_J1(x_init, y_init, x_fin, y_fin);
				else if(proprietaire==2)
					return testGeneralOr_J2(x_init, y_init, x_fin, y_fin);
				break;
				
			case Chariot_p:	//Chariot promu
				if(proprietaire==1)
					return testGeneralOr_J1(x_init, y_init, x_fin, y_fin);
				else if(proprietaire==2)
					return testGeneralOr_J2(x_init, y_init, x_fin, y_fin);
				break;
				
			case Cavalier_p:	//Cavalier promu
				if(proprietaire==1)
					return testGeneralOr_J1(x_init, y_init, x_fin, y_fin);
				else if(proprietaire==2)
					return testGeneralOr_J2(x_init, y_init, x_fin, y_fin);
				break;
				
			case Gen_arg_p:	//General d'argent promu
				if(proprietaire==1)
					return testGeneralOr_J1(x_init, y_init, x_fin, y_fin);
				else if(proprietaire==2)
					return testGeneralOr_J2(x_init, y_init, x_fin, y_fin);
				break;
				
			case Fou_p:	//Fou promu
					return testFouPromu(x_init,y_init, x_fin, y_fin,plateau);
				break;
				
			case Tour_p:	//Tour promue
					return testTourPromue(x_init,y_init, x_fin, y_fin,plateau);
				break;
				
			case General_Jade:	//General de jade
					return testGeneral(x_init, y_init, x_fin,y_fin);
				break;
				
			default:
				return -1;
				break;
		}
	}
	else 
		return -1;
}