Hi all,

=46irst, thanks to Jeremy for the Ruby Koans link.

Now I'm puzzled, Sensei!

I'm trying to write the code for the cases on lines 12 & 13 (see below) =
and I don't understand why they should be expected to raise exceptions. They =
appear to be isosceles triangles and pass the isosceles test.

Am I missing something subtle=3F Or something obvious=3F

**Leigh

"Things are not as they appear; nor are they otherwise."

---------------

The Master says:
  You have not yet reached enlightenment.
  I sense frustration. Do not be afraid to ask for help.

The answers you seek...
  TriangleError expected but nothing was raised.

Please meditate on the following code:
  /Users/leigh/koans/about=5Ftriangle=5Fproject=5F2.rb:12:in =
`test=5Fillegal=5Ftriangles=5Fthrow=5Fexceptions'

  def test=5Fillegal=5Ftriangles=5Fthrow=5Fexceptions
    assert=5Fraise(TriangleError) do triangle(0, 0, 0) end
    assert=5Fraise(TriangleError) do triangle(3, 4, -5) end
    assert=5Fraise(TriangleError) do triangle(1, 1, 3) end  # line 12
    assert=5Fraise(TriangleError) do triangle(2, 4, 2) end  # line 13
 end

These tests all pass, including two from the illegal exceptions test:

  def test=5Fisosceles=5Ftriangles=5Fhave=5Fexactly=5Ftwo=5Fsides=5Fequal
    assert=5Fequal :isosceles, triangle(3, 4, 4)  
    assert=5Fequal :isosceles, triangle(4, 3, 4)
    assert=5Fequal :isosceles, triangle(4, 4, 3)
    assert=5Fequal :isosceles, triangle(10, 10, 2)
    
    assert=5Fequal :isosceles, triangle(1, 1, 3) # these two are from
    assert=5Fequal :isosceles, triangle(2, 4, 2) # =
test=5Fillegal=5Ftriangles=5Fthrow=5Fexceptions
  end

Here's the triangle method:

def triangle(a, b, c)
  if (a <=3D 0) || (b <=3D 0) || (c <=3D 0)
    raise TriangleError
  end
  case
  when (a =3D=3D b) && (a =3D=3D c) && (b =3D=3D c)
    return :equilateral
  when (b =3D=3D c) || (a =3D=3D c) || (a =3D=3D b) 
    return :isosceles
  when !(a =3D=3D b) && !(a =3D=3D c) && !(b =3D=3D c)
    return :scalene
  else 
    return :oops!
  end
end