Skip to content

Commit

Permalink
Fix broken Line tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
thomthom committed Oct 25, 2019
1 parent 405e126 commit cec839e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions modules/line.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ def direction_internal

# @param [Geom::Point3d, Array(Numeric, Numeric, Numeric)] object
def valid_point3d?(object)
object.is_a?(Geom::Point3d) && valid_triple?(object)
object.is_a?(Geom::Point3d) || valid_triple?(object)
end

# @param [Geom::Vector3d, Array(Numeric, Numeric, Numeric)] object
def valid_vector3d?(object)
object.is_a?(Geom::Vector3d) && valid_triple?(object)
object.is_a?(Geom::Vector3d) || valid_triple?(object)
end

# @param [Array(Numeric, Numeric, Numeric)] object
Expand Down
8 changes: 4 additions & 4 deletions tests/TT_Lib/TC_Line.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def test_initialize_point_vector
line = Line.new(point, vector)
assert_kind_of(Line, line)
assert_kind_of(Array, line)
assert_equal([point, vector], line.to_a)
assert_equal([point, vector.normalize], line.to_a)
end

def test_initialize_two_points
Expand All @@ -32,7 +32,7 @@ def test_initialize_two_points
line = Line.new(point1, point2)
assert_kind_of(Line, line)
assert_kind_of(Array, line)
assert_equal([point, vector], line.to_a)
assert_equal([point1, vector], line.to_a)
end


Expand All @@ -48,14 +48,14 @@ def test_direction

def test_direction_array_vector
point = Geom::Point3d.new(10, 20, 30)
vector = Geom::Vector.new(1, 2, 3)
vector = Geom::Vector3d.new(1, 2, 3)
# This case is a little ambiguous, as array can substitute both points and
# vectors. #direction will assume vector.
# TODO: Check how SketchUp deal with this.
line = Line.new(point, [1, 2, 3])
result = line.direction
assert_kind_of(Geom::Vector3d, result)
assert_equal(vector, result)
assert_equal(vector.normalize, result)
end

def test_direction_cached_value
Expand Down

0 comments on commit cec839e

Please sign in to comment.