about_triangle_project_2.rb from Koans
Ruby
code posted
created at 22 Sep 02:29
Edit
|
Back
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
require File.expand_path(File.dirname(__FILE__) + '/edgecase') # You need to write the triangle method in the file 'triangle.rb' require 'triangle.rb' class AboutTriangleAssignment2 < EdgeCase::Koan # The first assignment did not talk about how to handle errors. # Let's handle that part now. def test_illegal_triangles_throw_exceptions assert_raise(TriangleError) do triangle(0, 0, 0) end assert_raise(TriangleError) do triangle(3, 4, -5) end assert_raise(TriangleError) do triangle(1, 1, 3) end assert_raise(TriangleError) do triangle(2, 4, 2) end end end |
597 Bytes in 2 ms with coderay