Решение на Шеста задача от Ростислав Георгиев
Обратно към всички решения
Към профила на Ростислав Георгиев
Резултати
- 4 точки от тестове
- 0 бонус точки
- 4 точки общо
- 12 успешни тест(а)
- 6 неуспешни тест(а)
Код
Лог от изпълнението
..F...F...F....FFF
Failures:
1) GameOfLife::Board enumeration responds to each, map, count, etc.
Failure/Error: board.should respond_to(enumerable_method)
expected #<GameOfLife::Board:0x9e91aac @cells=[]> to respond to :each_cons
# /tmp/d20111221-3114-ivbdbt/spec.rb:19:in `block (4 levels) in <top (required)>'
# /tmp/d20111221-3114-ivbdbt/spec.rb:18:in `each'
# /tmp/d20111221-3114-ivbdbt/spec.rb:18:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
2) GameOfLife::Board GameOfLife::Board enumeration live cells count returns the number of live cells on a board
Failure/Error: new_board([0, 0], [1, 1], [0, 0]).count.should eq 2
expected: 2
got: 3
(compared using ==)
# /tmp/d20111221-3114-ivbdbt/spec.rb:46:in `block (4 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
3) GameOfLife::Board evolution returns a new board
Failure/Error: next_gen = board.next_generation
NoMethodError:
undefined method `times' for nil:NilClass
# /tmp/d20111221-3114-ivbdbt/solution.rb:23:in `next_generation'
# /tmp/d20111221-3114-ivbdbt/spec.rb:74:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
4) GameOfLife::Board GameOfLife::Board evolution rules evolves a formation correctly
Failure/Error: board.count.should eq cells.count
expected: 7
got: 5
(compared using ==)
# /tmp/d20111221-3114-ivbdbt/spec.rb:172:in `expect_generation_in'
# /tmp/d20111221-3114-ivbdbt/spec.rb:136:in `block (4 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
5) GameOfLife::Board GameOfLife::Board evolution rules oscilates the oscilators
Failure/Error: (board.to_a - cells).should eq []
NoMethodError:
undefined method `to_a' for #<GameOfLife::Board:0x9feacdc>
# /tmp/d20111221-3114-ivbdbt/spec.rb:173:in `expect_generation_in'
# /tmp/d20111221-3114-ivbdbt/spec.rb:145:in `block (5 levels) in <top (required)>'
# /tmp/d20111221-3114-ivbdbt/spec.rb:142:in `times'
# /tmp/d20111221-3114-ivbdbt/spec.rb:142:in `block (4 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
6) GameOfLife::Board GameOfLife::Board evolution rules keeps stable formations stable
Failure/Error: (board.to_a - cells).should eq []
NoMethodError:
undefined method `to_a' for #<GameOfLife::Board:0x9fefef8>
# /tmp/d20111221-3114-ivbdbt/spec.rb:173:in `expect_generation_in'
# /tmp/d20111221-3114-ivbdbt/spec.rb:160:in `block (6 levels) in <top (required)>'
# /tmp/d20111221-3114-ivbdbt/spec.rb:158:in `times'
# /tmp/d20111221-3114-ivbdbt/spec.rb:158:in `block (5 levels) in <top (required)>'
# /tmp/d20111221-3114-ivbdbt/spec.rb:155:in `each'
# /tmp/d20111221-3114-ivbdbt/spec.rb:155:in `block (4 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/homework/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
Finished in 0.32372 seconds
18 examples, 6 failures
Failed examples:
rspec /tmp/d20111221-3114-ivbdbt/spec.rb:15 # GameOfLife::Board enumeration responds to each, map, count, etc.
rspec /tmp/d20111221-3114-ivbdbt/spec.rb:43 # GameOfLife::Board GameOfLife::Board enumeration live cells count returns the number of live cells on a board
rspec /tmp/d20111221-3114-ivbdbt/spec.rb:72 # GameOfLife::Board evolution returns a new board
rspec /tmp/d20111221-3114-ivbdbt/spec.rb:129 # GameOfLife::Board GameOfLife::Board evolution rules evolves a formation correctly
rspec /tmp/d20111221-3114-ivbdbt/spec.rb:139 # GameOfLife::Board GameOfLife::Board evolution rules oscilates the oscilators
rspec /tmp/d20111221-3114-ivbdbt/spec.rb:151 # GameOfLife::Board GameOfLife::Board evolution rules keeps stable formations stable
История (1 версия и 0 коментара)
Ростислав обнови решението на 20.12.2011 16:30 (преди около 13 години)