Решение на Втора задача от Светлозар Тодоров
Обратно към всички решения
Към профила на Светлозар Тодоров
Резултати
- 4 точки от тестове
- 0 бонус точки
- 4 точки общо
- 15 успешни тест(а)
- 9 неуспешни тест(а)
Код
Лог от изпълнението
...........FF...FFFFFF.F
Failures:
1) NumberSet can filter by custom filter
Failure/Error: filtered_numbers = numbers[using]
LocalJumpError:
no block given (yield)
# /tmp/d20141028-18133-1u2cw2u/solution.rb:49:in `block in extract'
# /tmp/d20141028-18133-1u2cw2u/solution.rb:10:in `call'
# /tmp/d20141028-18133-1u2cw2u/solution.rb:10:in `block in each'
# /tmp/d20141028-18133-1u2cw2u/solution.rb:8:in `each'
# /tmp/d20141028-18133-1u2cw2u/solution.rb:8:in `each'
# /tmp/d20141028-18133-1u2cw2u/solution.rb:49:in `extract'
# /tmp/d20141028-18133-1u2cw2u/solution.rb:38:in `[]'
# /tmp/d20141028-18133-1u2cw2u/spec.rb:179:in `can_filter'
# /tmp/d20141028-18133-1u2cw2u/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)>'
2) NumberSet can filter positive numbers
Failure/Error: expect(filtered_numbers.size).to eq expecting.size
expected: 1
got: 2
(compared using ==)
# /tmp/d20141028-18133-1u2cw2u/spec.rb:180:in `can_filter'
# /tmp/d20141028-18133-1u2cw2u/spec.rb:67: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) NumberSet can combine two filters with "and" rule
Failure/Error: filtered_numbers = numbers[using]
NoMethodError:
undefined method `extract' for #<Proc:0xb9478100>
# /tmp/d20141028-18133-1u2cw2u/solution.rb:38:in `[]'
# /tmp/d20141028-18133-1u2cw2u/spec.rb:179:in `can_filter'
# /tmp/d20141028-18133-1u2cw2u/spec.rb:92: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) NumberSet can combine two filters with "or" rule
Failure/Error: filtered_numbers = numbers[using]
NoMethodError:
undefined method `extract' for #<Proc:0xb938f658>
# /tmp/d20141028-18133-1u2cw2u/solution.rb:38:in `[]'
# /tmp/d20141028-18133-1u2cw2u/spec.rb:179:in `can_filter'
# /tmp/d20141028-18133-1u2cw2u/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)>'
5) NumberSet can combine multiple filters with "and" rule
Failure/Error: filter = non_negative & non_zero & mod_3_is_zero
NoMethodError:
undefined method `&' for #<Proc:0xb938eaa0>
# /tmp/d20141028-18133-1u2cw2u/spec.rb:108: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) NumberSet can combine multiple filters with "or" rule
Failure/Error: filter = even | negative | more_than_100
NoMethodError:
undefined method `|' for #<Proc:0xb938df24>
# /tmp/d20141028-18133-1u2cw2u/spec.rb:118: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) NumberSet can combine multiple filters with "and" and "or" rules
Failure/Error: filter = even & negative | mod_3_is_zero
NoMethodError:
undefined method `|' for #<Proc:0xb938d3f8>
# /tmp/d20141028-18133-1u2cw2u/spec.rb:128: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)>'
8) NumberSet can combine multiple filters with "and", "or" and parenthesis
Failure/Error: filtered_numbers = numbers[using]
NoMethodError:
undefined method `extract' for #<Proc:0xb938c7a0>
# /tmp/d20141028-18133-1u2cw2u/solution.rb:38:in `[]'
# /tmp/d20141028-18133-1u2cw2u/spec.rb:179:in `can_filter'
# /tmp/d20141028-18133-1u2cw2u/spec.rb:139: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)>'
9) NumberSet returns enumerable of set's contents if no block is given to each
Failure/Error: expect(numbers.each.to_a.size).to eq [1, 3, 5].size
LocalJumpError:
no block given (yield)
# /tmp/d20141028-18133-1u2cw2u/solution.rb:12:in `block in each'
# /tmp/d20141028-18133-1u2cw2u/solution.rb:8:in `each'
# /tmp/d20141028-18133-1u2cw2u/solution.rb:8:in `each'
# /tmp/d20141028-18133-1u2cw2u/spec.rb:164: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.02176 seconds
24 examples, 9 failures
Failed examples:
rspec /tmp/d20141028-18133-1u2cw2u/spec.rb:60 # NumberSet can filter by custom filter
rspec /tmp/d20141028-18133-1u2cw2u/spec.rb:66 # NumberSet can filter positive numbers
rspec /tmp/d20141028-18133-1u2cw2u/spec.rb:90 # NumberSet can combine two filters with "and" rule
rspec /tmp/d20141028-18133-1u2cw2u/spec.rb:97 # NumberSet can combine two filters with "or" rule
rspec /tmp/d20141028-18133-1u2cw2u/spec.rb:104 # NumberSet can combine multiple filters with "and" rule
rspec /tmp/d20141028-18133-1u2cw2u/spec.rb:114 # NumberSet can combine multiple filters with "or" rule
rspec /tmp/d20141028-18133-1u2cw2u/spec.rb:124 # NumberSet can combine multiple filters with "and" and "or" rules
rspec /tmp/d20141028-18133-1u2cw2u/spec.rb:134 # NumberSet can combine multiple filters with "and", "or" and parenthesis
rspec /tmp/d20141028-18133-1u2cw2u/spec.rb:159 # NumberSet returns enumerable of set's contents if no block is given to each
История (5 версии и 2 коментара)
Светлозар обнови решението на 26.10.2014 20:06 (преди около 10 години)
Светлозар обнови решението на 27.10.2014 01:34 (преди около 10 години)
Светлозар обнови решението на 27.10.2014 02:12 (преди около 10 години)
Светлозар обнови решението на 27.10.2014 02:14 (преди около 10 години)
Светлозар обнови решението на 27.10.2014 02:34 (преди около 10 години)