From d3260e467da068e8dc2661459460fbe3e2375685 Mon Sep 17 00:00:00 2001 From: pxalcantara Date: Sat, 1 Aug 2020 20:44:55 -0300 Subject: [PATCH] add Max test to .rb file Signed-off-by: pxalcantara --- src/Vector2_TEST.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/Vector2_TEST.rb b/src/Vector2_TEST.rb index 58bbd8ee5..da341631c 100644 --- a/src/Vector2_TEST.rb +++ b/src/Vector2_TEST.rb @@ -108,6 +108,23 @@ def test_equal_tolerance "Zero should equal 1 with 1.1 tolerance") end + def test_max + vec1 = Ignition::Math::Vector2d.new(0.1, 0.2) + vec2 = Ignition::Math::Vector2d.new(0.3, 0.5) + vec3 = Ignition::Math::Vector2d.new(0.4, 0.2) + + assert((vec1.Max() - 0.2).abs() < 1e-10, + "Vector3 vec1.Max should equal 0.3") + + vec1.Max(vec2) + assert(vec1 == Ignition::Math::Vector2d.new(0.3, 0.5), + "Vector2 vec1 should equal [0.3, 0.5]") + + vec1.Max(vec3) + assert(vec1 == Ignition::Math::Vector2d.new(0.4, 0.5), + "Vector2 vec1 should equal [0.4, 0.5]") + end + def test_dot v = Ignition::Math::Vector2d.new(1, 2)