before kata

This commit is contained in:
Gwenhael Le Moine 2011-05-21 15:06:10 +07:00
parent 2f98f6fa09
commit 3ec2e98afa

26
star.rb
View file

@ -1,3 +1,5 @@
require 'test/unit'
class Star
def initialize
@levelsets = {
@ -377,15 +379,21 @@ class Star
end
end
st = Star.new
puts st.to_s
moves = [ :down, :right, :down, :left, :up, :right, :up, :left, :down, :right, :down, :left, :right, :up, :left, :up, :right, :up, :down, :left, :up, :right, :down, :up, :left, ]
class TestBla < Test::Unit::TestCase
def test_level_completion
st = Star.new
puts st.to_s
moves.map do
|direction|
st.move( direction )
puts st.is_it_over? ? "YES \o/" : "not yet"
moves = [ :down, :right, :down, :left, :up, :right, :up, :left, :down, :right, :down, :left, :right, :up, :left, :up, :right, :up, :down, :left, :up, :right, :down, :up, :left, ]
moves.each do
|direction|
st.move( direction )
# puts st.is_it_over? ? "YES \o/" : "not yet"
end
puts st.to_s
assert_equal( true, st.is_it_over? )
end
end
puts st.to_s