mirror of
https://github.com/gwenhael-le-moine/c-urs_-toil-s.git
synced 2024-11-16 19:48:26 +01:00
before kata
This commit is contained in:
parent
2f98f6fa09
commit
3ec2e98afa
1 changed files with 17 additions and 9 deletions
26
star.rb
26
star.rb
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue