Skip to content

Commit

Permalink
add Max test to .rb file
Browse files Browse the repository at this point in the history
Signed-off-by: pxalcantara <[email protected]>
  • Loading branch information
pxalcantara committed Aug 1, 2020
1 parent ecbf684 commit d3260e4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Vector2_TEST.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit d3260e4

Please sign in to comment.