Esempio n. 1
0
int main (int narg, char** argv) {
    test_2d();
    test_3d();
    test_5d4();
    test_5d5();
    return 0;
}
Esempio n. 2
0
void TestApp::test_matrix_mat3()
{
	Console::write_line("  Class: Mat3");

	Console::write_line("   Function: inverse()");
	{
		Mat3d test_src(2, 3, 4, 2, -5, 2, -3, 6, -3);
		Mat3d test_inv;
		Mat3d test_dest;
		Mat3d test_ident = Mat3d::identity();

		test_dest = test_src;
		test_dest.inverse();
		test_dest = test_dest * test_src;

		if (test_ident != test_dest) fail();

		Mat4d test_4d(test_src);
		Mat3d test_3d(test_4d);
		if (test_3d != test_src) fail();

		test_4d =test_src;
		test_3d =test_4d;
		if (test_3d != test_src) fail();
	}

	Mat3i test_a(3, 1, 2, 4, 5 ,6, 4, 2, 1);
	Mat3i test_b(4, 7, 2, 5, 3, 5, 2, 9, 3);

	Console::write_line("   Function: multiply() and operator");
	{
		Mat3i result = test_b * test_a;
		Mat3i answer(21, 42, 17, 53, 97, 51, 28, 43, 21);
		if (result != answer) fail();

		result = Mat3i::multiply(test_b, test_a);
		if (result != answer) fail();

	}

	Console::write_line("   Function: add() and operator");
	{
		Mat3i result = test_a + test_b;
		if (result != Mat3i(7, 8, 4, 9, 8, 11, 6, 11, 4)) fail();

		result = Mat3i::add(test_a, test_b);
		if (result != Mat3i(7, 8, 4, 9, 8, 11, 6, 11, 4)) fail();

	}

	Console::write_line("   Function: subtract() and operator");
	{
		Mat3i result = test_a - test_b;
		if (result != Mat3i(-1, -6, 0, -1, 2, 1, 2, -7, -2)) fail();

		result = Mat3i::subtract(test_a, test_b);
		if (result != Mat3i(-1, -6, 0, -1, 2, 1, 2, -7, -2)) fail();
	}
}
Esempio n. 3
0
int test_main( int , char* [] )
{
    test_all<bg::model::d2::point_xy<int> >();
    test_all<bg::model::d2::point_xy<double> >();

    //test_spherical<bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree> > >();

    test_mixed();
    test_3d();


#if defined(HAVE_TTMATH)
    test_all<bg::model::d2::point_xy<ttmath_big> >();
    //test_spherical<bg::model::point<ttmath_big, 2, bg::cs::spherical_equatorial<bg::degree> > >();
#endif

    return 0;
}