diff --git a/qa/tests/libs/kimath/math/test_vector2.cpp b/qa/tests/libs/kimath/math/test_vector2.cpp index e345dd73b5..5a03244f3f 100644 --- a/qa/tests/libs/kimath/math/test_vector2.cpp +++ b/qa/tests/libs/kimath/math/test_vector2.cpp @@ -51,4 +51,18 @@ BOOST_AUTO_TEST_CASE( test_dot_product, *boost::unit_test::tolerance( 0.000001 ) BOOST_CHECK( v2.Dot( v1 ) == 0 ); } +BOOST_AUTO_TEST_CASE( test_resize, *boost::unit_test::tolerance( 0.000001 ) ) +{ + // a few vectors just to ensure the sign change happens as needed + VECTOR2I v1( 4, 3 ); + VECTOR2I v2( 5, -1 ); + VECTOR2I v3( -2, 1 ); + VECTOR2I v4( 1, 1 ); + + BOOST_CHECK( v1.Resize( 8 ) == VECTOR2I( 6, 4 ) ); + BOOST_CHECK( v2.Resize( 10 ) == VECTOR2I( 9, -2 ) ); + BOOST_CHECK( v3.Resize( 4 ) == VECTOR2I( -3, 1 ) ); + BOOST_CHECK( v4.Resize( 1 ) == VECTOR2I( 1, 1 ) ); +} + BOOST_AUTO_TEST_SUITE_END()