Решение на Втора задача от Боян Дончев
Обратно към всички решения
Към профила на Боян Дончев
Резултати
- 4 точки от тестове
- 0 бонус точки
- 4 точки общо
- 14 успешни тест(а)
- 6 неуспешни тест(а)
Код
Лог от изпълнението
F.FF........F..F...F
Failures:
1) #move moves snake up/right/left/down
Failure/Error: expect(move(snake, [1, 0])).to eq([[2, 3], [2, 4], [2, 5], [3, 5]])
expected: [[2, 3], [2, 4], [2, 5], [3, 5]]
got: [[2, 4], [2, 5], [3, 5]]
(compared using ==)
# /tmp/d20151026-15631-j54wek/spec.rb:6:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
2) #move does not mutate the given arguments
Failure/Error: expect { move(snake, direction) }.not_to change { snake }
result should not have changed, but did change from [[2, 2], [2, 3], [2, 4], [2, 5]] to [[2, 3], [2, 4], [2, 5]]
# /tmp/d20151026-15631-j54wek/spec.rb:17:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
3) #grow grows snake up/right/left/down
Failure/Error: expect(grow(snake, [0, -1])).to eq([[2, 2], [2, 3], [2, 4], [2, 5], [2, 4]])
expected: [[2, 2], [2, 3], [2, 4], [2, 5], [2, 4]]
got: [[2, 2], [2, 3], [2, 4], [2, 5]]
(compared using ==)
# /tmp/d20151026-15631-j54wek/spec.rb:29:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
4) #obstacle_ahead? returns true if snake body ahead
Failure/Error: expect(
expected: true
got: false
(compared using ==)
# /tmp/d20151026-15631-j54wek/spec.rb:83:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
5) #obstacle_ahead? does not mutate the given arguments
Failure/Error: expect { obstacle_ahead?(snake, direction, dimensions) }.not_to change { snake }
result should not have changed, but did change from [[1, 2], [1, 3]] to [[1, 3]]
# /tmp/d20151026-15631-j54wek/spec.rb:99:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
6) #danger? does not mutate the given arguments
Failure/Error: expect { danger?(snake, direction, dimensions) }.not_to change { snake }
result should not have changed, but did change from [[1, 2], [1, 3]] to []
# /tmp/d20151026-15631-j54wek/spec.rb:123:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
Finished in 0.01593 seconds
20 examples, 6 failures
Failed examples:
rspec /tmp/d20151026-15631-j54wek/spec.rb:4 # #move moves snake up/right/left/down
rspec /tmp/d20151026-15631-j54wek/spec.rb:15 # #move does not mutate the given arguments
rspec /tmp/d20151026-15631-j54wek/spec.rb:25 # #grow grows snake up/right/left/down
rspec /tmp/d20151026-15631-j54wek/spec.rb:82 # #obstacle_ahead? returns true if snake body ahead
rspec /tmp/d20151026-15631-j54wek/spec.rb:96 # #obstacle_ahead? does not mutate the given arguments
rspec /tmp/d20151026-15631-j54wek/spec.rb:120 # #danger? does not mutate the given arguments
История (6 версии и 0 коментара)
Боян обнови решението на 17.10.2015 17:42 (преди над 9 години)
Боян обнови решението на 18.10.2015 23:05 (преди над 9 години)
Боян обнови решението на 18.10.2015 23:19 (преди над 9 години)
Боян обнови решението на 18.10.2015 23:20 (преди над 9 години)
Боян обнови решението на 18.10.2015 23:26 (преди над 9 години)
Боян обнови решението на 18.10.2015 23:39 (преди над 9 години)