Решение на Втора задача от Пламена Петрова
Обратно към всички решения
Към профила на Пламена Петрова
Резултати
- 4 точки от тестове
- 0 бонус точки
- 4 точки общо
- 13 успешни тест(а)
- 7 неуспешни тест(а)
Код
Лог от изпълнението
.F....FFFFFF........
Failures:
1) #move moves one-position-sized snake
Failure/Error: expect(move([[2, 2]], [-1, 0])).to eq([[1, 2]])
NoMethodError:
undefined method `[]' for nil:NilClass
# /tmp/d20151026-15631-1oz4lxp/solution.rb:18:in `grow'
# /tmp/d20151026-15631-1oz4lxp/solution.rb:4:in `move'
# /tmp/d20151026-15631-1oz4lxp/spec.rb:12: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) #new_food generates food on empty position
Failure/Error: let(:next_food) { new_food(food, snake, dimensions) }
NoMethodError:
undefined method `all_possitions_available' for #<RSpec::Core::ExampleGroup::Nested_3:0x007f1d9fbc2a78>
# /tmp/d20151026-15631-1oz4lxp/solution.rb:12:in `new_food'
# /tmp/d20151026-15631-1oz4lxp/spec.rb:47:in `block (2 levels) in <top (required)>'
# /tmp/d20151026-15631-1oz4lxp/spec.rb:53: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) #new_food does not generate food outside of borders (width)
Failure/Error: let(:next_food) { new_food(food, snake, dimensions) }
NoMethodError:
undefined method `all_possitions_available' for #<RSpec::Core::ExampleGroup::Nested_3:0x007f1d9fbc2758>
# /tmp/d20151026-15631-1oz4lxp/solution.rb:12:in `new_food'
# /tmp/d20151026-15631-1oz4lxp/spec.rb:47:in `block (2 levels) in <top (required)>'
# /tmp/d20151026-15631-1oz4lxp/spec.rb:57: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) #new_food does not generate food outside of borders (height)
Failure/Error: let(:next_food) { new_food(food, snake, dimensions) }
NoMethodError:
undefined method `all_possitions_available' for #<RSpec::Core::ExampleGroup::Nested_3:0x007f1d9fbbc9c0>
# /tmp/d20151026-15631-1oz4lxp/solution.rb:12:in `new_food'
# /tmp/d20151026-15631-1oz4lxp/spec.rb:47:in `block (2 levels) in <top (required)>'
# /tmp/d20151026-15631-1oz4lxp/spec.rb:61: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) #new_food does not generate food on position where the snake is
Failure/Error: let(:next_food) { new_food(food, snake, dimensions) }
NoMethodError:
undefined method `all_possitions_available' for #<RSpec::Core::ExampleGroup::Nested_3:0x007f1d9fbaa388>
# /tmp/d20151026-15631-1oz4lxp/solution.rb:12:in `new_food'
# /tmp/d20151026-15631-1oz4lxp/spec.rb:47:in `block (2 levels) in <top (required)>'
# /tmp/d20151026-15631-1oz4lxp/spec.rb:65: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) #new_food does not generate food on position where food is already present
Failure/Error: let(:next_food) { new_food(food, snake, dimensions) }
NoMethodError:
undefined method `all_possitions_available' for #<RSpec::Core::ExampleGroup::Nested_3:0x007f1d9fba2f20>
# /tmp/d20151026-15631-1oz4lxp/solution.rb:12:in `new_food'
# /tmp/d20151026-15631-1oz4lxp/spec.rb:47:in `block (2 levels) in <top (required)>'
# /tmp/d20151026-15631-1oz4lxp/spec.rb:69: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)>'
7) #new_food does not mutate the given arguments
Failure/Error: expect { new_food(food, snake, dimensions) }.not_to change { snake }
NoMethodError:
undefined method `all_possitions_available' for #<RSpec::Core::ExampleGroup::Nested_3:0x007f1d9fb9e6a0>
# /tmp/d20151026-15631-1oz4lxp/solution.rb:12:in `new_food'
# /tmp/d20151026-15631-1oz4lxp/spec.rb:73:in `block (3 levels) in <top (required)>'
# /tmp/d20151026-15631-1oz4lxp/spec.rb:73: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.01159 seconds
20 examples, 7 failures
Failed examples:
rspec /tmp/d20151026-15631-1oz4lxp/spec.rb:11 # #move moves one-position-sized snake
rspec /tmp/d20151026-15631-1oz4lxp/spec.rb:49 # #new_food generates food on empty position
rspec /tmp/d20151026-15631-1oz4lxp/spec.rb:56 # #new_food does not generate food outside of borders (width)
rspec /tmp/d20151026-15631-1oz4lxp/spec.rb:60 # #new_food does not generate food outside of borders (height)
rspec /tmp/d20151026-15631-1oz4lxp/spec.rb:64 # #new_food does not generate food on position where the snake is
rspec /tmp/d20151026-15631-1oz4lxp/spec.rb:68 # #new_food does not generate food on position where food is already present
rspec /tmp/d20151026-15631-1oz4lxp/spec.rb:72 # #new_food does not mutate the given arguments
История (2 версии и 1 коментар)
Пламена обнови решението на 16.10.2015 11:42 (преди над 9 години)
Пламена обнови решението на 19.10.2015 15:04 (преди над 9 години)