Решение на Втора задача - хешове, масиви и структура от Йордан Пулов
Обратно към всички решения
Към профила на Йордан Пулов
Резултати
- 5 точки от тестове
- 0 бонус точки
- 5 точки общо
- 12 успешни тест(а)
- 3 неуспешни тест(а)
Код
Лог от изпълнението
....F.F......F.
Failures:
1) Task 2 Hash#fetch_deep returns nil for non-existant keys
Failure/Error: expect(input.fetch_deep('meal.0.type')).to be nil
NoMethodError:
undefined method `[]' for nil:NilClass
# /tmp/d20161024-13689-18z5xez/solution.rb:22:in `block in fetch_deep'
# /tmp/d20161024-13689-18z5xez/solution.rb:21:in `each'
# /tmp/d20161024-13689-18z5xez/solution.rb:21:in `fetch_deep'
# /tmp/d20161024-13689-18z5xez/spec.rb:89:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
2) Task 2 Hash#fetch_deep does not modify the input hash
Failure/Error: input.fetch_deep('menu.order')
NoMethodError:
undefined method `to_sym' for 3:Fixnum
# /tmp/d20161024-13689-18z5xez/solution.rb:13:in `block in convert_keys_to_sym'
# /tmp/d20161024-13689-18z5xez/solution.rb:11:in `map'
# /tmp/d20161024-13689-18z5xez/solution.rb:11:in `convert_keys_to_sym'
# /tmp/d20161024-13689-18z5xez/solution.rb:3:in `convert_entry_keys_to_sym'
# /tmp/d20161024-13689-18z5xez/solution.rb:14:in `block in convert_keys_to_sym'
# /tmp/d20161024-13689-18z5xez/solution.rb:11:in `map'
# /tmp/d20161024-13689-18z5xez/solution.rb:11:in `convert_keys_to_sym'
# /tmp/d20161024-13689-18z5xez/solution.rb:20:in `fetch_deep'
# /tmp/d20161024-13689-18z5xez/spec.rb:102:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
3) Task 2 Hash#reshape does not modify the input hash
Failure/Error: input.reshape(shape)
NoMethodError:
undefined method `to_sym' for 3:Fixnum
# /tmp/d20161024-13689-18z5xez/solution.rb:13:in `block in convert_keys_to_sym'
# /tmp/d20161024-13689-18z5xez/solution.rb:11:in `map'
# /tmp/d20161024-13689-18z5xez/solution.rb:11:in `convert_keys_to_sym'
# /tmp/d20161024-13689-18z5xez/solution.rb:3:in `convert_entry_keys_to_sym'
# /tmp/d20161024-13689-18z5xez/solution.rb:14:in `block in convert_keys_to_sym'
# /tmp/d20161024-13689-18z5xez/solution.rb:11:in `map'
# /tmp/d20161024-13689-18z5xez/solution.rb:11:in `convert_keys_to_sym'
# /tmp/d20161024-13689-18z5xez/solution.rb:20:in `fetch_deep'
# /tmp/d20161024-13689-18z5xez/solution.rb:30:in `block in reshape'
# /tmp/d20161024-13689-18z5xez/solution.rb:28:in `map'
# /tmp/d20161024-13689-18z5xez/solution.rb:28:in `reshape'
# /tmp/d20161024-13689-18z5xez/spec.rb:194:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
Finished in 0.00821 seconds
15 examples, 3 failures
Failed examples:
rspec /tmp/d20161024-13689-18z5xez/spec.rb:85 # Task 2 Hash#fetch_deep returns nil for non-existant keys
rspec /tmp/d20161024-13689-18z5xez/spec.rb:99 # Task 2 Hash#fetch_deep does not modify the input hash
rspec /tmp/d20161024-13689-18z5xez/spec.rb:180 # Task 2 Hash#reshape does not modify the input hash
История (1 версия и 0 коментара)
Йордан обнови решението на 19.10.2016 22:37 (преди около 8 години)