Skip to content

Commit

Permalink
Pass epsilon to Vector2:FuzzyEq()
Browse files Browse the repository at this point in the history
  • Loading branch information
ZachCurtis committed Jul 19, 2024
1 parent 362c850 commit 83067d4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/roblox/datatypes/Vector2.luau
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ assert(Vector2.new(-1.7, 2):Sign() == Vector2.new(-1, 1))
assert(Vector2.new(-1.9, 2.1):Ceil() == Vector2.new(-1, 3))
assert(Vector2.new(-1.1, 2.99):Floor() == Vector2.new(-2, 2))

assert(Vector2.new(1, 2):FuzzyEq(Vector2.new(1 - 1e-6, 2 + 1e-6)))
assert(Vector2.new(1, 2):FuzzyEq(Vector2.new(1 - 1e-6, 2 + 1e-6), 1e-5))
assert(not Vector2.new(1, 2):FuzzyEq(Vector2.new(1.2, 2), 0.1))

local angle = Vector2.new(1, 1):Angle(Vector2.new(-1, 1))
assert(math.abs(angle - (math.pi / 2)) < 1e-5)

0 comments on commit 83067d4

Please sign in to comment.