4 class TestPoint < Test::Unit::TestCase
12 assert_equal Point.new(4, 5), Point.new(4, 5)
13 assert_not_equal Point.new(4, 5), Point.new(1, 2)
17 assert_equal Point.new(7, 1), Point.new(3, 4) + Point.new(4, -3)
21 assert_equal Point.new(4, 5), Point.new(10, 2) - Point.new(6, -3)
25 assert_equal Point.new(6, 2), Point.new(3, 1) * 2
26 assert_equal Point.new(3, 9), Point.new(12, 36) / 4
30 assert_equal Point.new(1, 1), Point.new(3, 3).unit
31 assert_equal Point.new(1, 0), Point.new(4, 0).unit
32 assert_equal Point.new(0, 0), Point.new(0, 0).unit
33 assert_equal Point.new(-1, 1), Point.new(-5, 5).unit
37 assert_equal -1, -5.unit
38 assert_equal 0, 0.unit
39 assert_equal 1, 83.unit
40 assert_equal -1, -0.34.unit
44 assert_equal 'e4', Point.new(4, 4).to_coord(8)
45 assert_equal 'b9', Point.new(1, 0).to_coord(9)
49 assert_equal Point.new(4, 3), Point.from_coord('e5', 8)
50 assert_equal Point.new(0, 0), Point.from_coord('a8', 8)
51 assert_equal Point.new(6, 2), Point.from_coord('g6', 8)