Skip to content

Commit 94f79f1

Browse files
committed
triangle_points test
1 parent e7a689c commit 94f79f1

File tree

4 files changed

+34
-2
lines changed

4 files changed

+34
-2
lines changed

Rakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ desc 'Test'
55
task :test do
66
sh 'jruby test/pbisector_test.rb'
77
sh 'jruby test/circumcircle_test.rb'
8+
sh 'jruby test/triangle_points_test.rb'
89
end

test/circumcircle_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require_relative './test_helper'
22
require_relative '../lib/math_demo/circumcircle'
33

4-
METHODS = [:center, :radius, :calculate]
4+
METHODS = %i(center radius calculate).freeze
55

66
class CircumcircleTest < Minitest::Test
77
def setup

test/pbisector_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require_relative './test_helper'
22
require_relative '../lib/math_demo/pbisector'
33

4-
METHODS = [:midpoint, :angle]
4+
METHODS = %i(midpoint angle).freeze
55

66
class PBisectorTest < Minitest::Test
77
def setup

test/triangle_points_test.rb

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
require_relative './test_helper'
2+
require_relative '../lib/math_demo/triangle_points'
3+
4+
METHODS = %i(each map size shift clear [] collinear? full?).freeze
5+
6+
class TrianglePointsTest < Minitest::Test
7+
def setup
8+
@tpoints = TrianglePoints.new
9+
@tpoints << Vec2D.new(0, 0)
10+
@tpoints << Vec2D.new(100, 100)
11+
@tpoints << Vec2D.new(300, 300)
12+
end
13+
14+
def test_respond
15+
METHODS.each do |method_string|
16+
assert_respond_to @tpoints, method_string
17+
end
18+
end
19+
20+
def test_collinear_true
21+
assert @tpoints.collinear?
22+
end
23+
24+
def test_full_true
25+
assert @tpoints.full?
26+
end
27+
28+
def tear_down
29+
@tpoints = nil?
30+
end
31+
end

0 commit comments

Comments
 (0)