Решение на Втора задача от Любомир Иванов
Обратно към всички решения
Към профила на Любомир Иванов
Резултати
- 3 точки от тестове
- 0 бонус точки
- 3 точки общо
- 10 успешни тест(а)
- 14 неуспешни тест(а)
Код
Лог от изпълнението
........FFFFFFFFFFFFFF..
Failures:
1) NumberSet can filter by complex type
Failure/Error: filtered_numbers = numbers[using]
NoMethodError:
undefined method `call' for #<TypeFilter:0xb98c66d0 @type=:complex>
# /tmp/d20141028-18133-11j3717/solution.rb:29:in `block in []'
# /tmp/d20141028-18133-11j3717/solution.rb:5:in `each'
# /tmp/d20141028-18133-11j3717/solution.rb:5:in `each'
# /tmp/d20141028-18133-11j3717/solution.rb:28:in `[]'
# /tmp/d20141028-18133-11j3717/spec.rb:179:in `can_filter'
# /tmp/d20141028-18133-11j3717/spec.rb:43: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 by integer type
Failure/Error: filtered_numbers = numbers[using]
NoMethodError:
undefined method `call' for #<TypeFilter:0xb98c5a3c @type=:integer>
# /tmp/d20141028-18133-11j3717/solution.rb:29:in `block in []'
# /tmp/d20141028-18133-11j3717/solution.rb:5:in `each'
# /tmp/d20141028-18133-11j3717/solution.rb:5:in `each'
# /tmp/d20141028-18133-11j3717/solution.rb:28:in `[]'
# /tmp/d20141028-18133-11j3717/spec.rb:179:in `can_filter'
# /tmp/d20141028-18133-11j3717/spec.rb:49: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 filter by real type
Failure/Error: filtered_numbers = numbers[using]
NoMethodError:
undefined method `call' for #<TypeFilter:0xb98c4e20 @type=:real>
# /tmp/d20141028-18133-11j3717/solution.rb:29:in `block in []'
# /tmp/d20141028-18133-11j3717/solution.rb:5:in `each'
# /tmp/d20141028-18133-11j3717/solution.rb:5:in `each'
# /tmp/d20141028-18133-11j3717/solution.rb:28:in `[]'
# /tmp/d20141028-18133-11j3717/spec.rb:179:in `can_filter'
# /tmp/d20141028-18133-11j3717/spec.rb:55: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 filter by custom filter
Failure/Error: filtered_numbers = numbers[using]
NoMethodError:
undefined method `call' for #<Filter:0xb98c427c>
# /tmp/d20141028-18133-11j3717/solution.rb:29:in `block in []'
# /tmp/d20141028-18133-11j3717/solution.rb:5:in `each'
# /tmp/d20141028-18133-11j3717/solution.rb:5:in `each'
# /tmp/d20141028-18133-11j3717/solution.rb:28:in `[]'
# /tmp/d20141028-18133-11j3717/spec.rb:179:in `can_filter'
# /tmp/d20141028-18133-11j3717/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) NumberSet can filter positive numbers
Failure/Error: filtered_numbers = numbers[using]
NoMethodError:
undefined method `call' for #<SignFilter:0xb99377e0 @sign_type=:positive>
# /tmp/d20141028-18133-11j3717/solution.rb:29:in `block in []'
# /tmp/d20141028-18133-11j3717/solution.rb:5:in `each'
# /tmp/d20141028-18133-11j3717/solution.rb:5:in `each'
# /tmp/d20141028-18133-11j3717/solution.rb:28:in `[]'
# /tmp/d20141028-18133-11j3717/spec.rb:179:in `can_filter'
# /tmp/d20141028-18133-11j3717/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)>'
6) NumberSet can filter non-positive numbers
Failure/Error: filtered_numbers = numbers[using]
NoMethodError:
undefined method `call' for #<SignFilter:0xb9936bd8 @sign_type=:non_positive>
# /tmp/d20141028-18133-11j3717/solution.rb:29:in `block in []'
# /tmp/d20141028-18133-11j3717/solution.rb:5:in `each'
# /tmp/d20141028-18133-11j3717/solution.rb:5:in `each'
# /tmp/d20141028-18133-11j3717/solution.rb:28:in `[]'
# /tmp/d20141028-18133-11j3717/spec.rb:179:in `can_filter'
# /tmp/d20141028-18133-11j3717/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)>'
7) NumberSet can filter negative numbers
Failure/Error: filtered_numbers = numbers[using]
NoMethodError:
undefined method `call' for #<SignFilter:0xb9935f6c @sign_type=:negative>
# /tmp/d20141028-18133-11j3717/solution.rb:29:in `block in []'
# /tmp/d20141028-18133-11j3717/solution.rb:5:in `each'
# /tmp/d20141028-18133-11j3717/solution.rb:5:in `each'
# /tmp/d20141028-18133-11j3717/solution.rb:28:in `[]'
# /tmp/d20141028-18133-11j3717/spec.rb:179:in `can_filter'
# /tmp/d20141028-18133-11j3717/spec.rb:79: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 filter non-negative numbers
Failure/Error: filtered_numbers = numbers[using]
NoMethodError:
undefined method `call' for #<SignFilter:0xb99353c8 @sign_type=:non_negative>
# /tmp/d20141028-18133-11j3717/solution.rb:29:in `block in []'
# /tmp/d20141028-18133-11j3717/solution.rb:5:in `each'
# /tmp/d20141028-18133-11j3717/solution.rb:5:in `each'
# /tmp/d20141028-18133-11j3717/solution.rb:28:in `[]'
# /tmp/d20141028-18133-11j3717/spec.rb:179:in `can_filter'
# /tmp/d20141028-18133-11j3717/spec.rb:85: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 can combine two filters with "and" rule
Failure/Error: filter = SignFilter.new(:non_negative) & Filter.new { |number| number != 0 }
NoMethodError:
undefined method `&' for #<SignFilter:0xb993416c @sign_type=:non_negative>
# /tmp/d20141028-18133-11j3717/spec.rb:91: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)>'
10) NumberSet can combine two filters with "or" rule
Failure/Error: filter = Filter.new { |number| number % 2 == 0 } | Filter.new { |number| number > 5 }
NoMethodError:
undefined method `|' for #<Filter:0xb994f1b0>
# /tmp/d20141028-18133-11j3717/spec.rb:98: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)>'
11) NumberSet can combine multiple filters with "and" rule
Failure/Error: filter = non_negative & non_zero & mod_3_is_zero
NoMethodError:
undefined method `&' for #<SignFilter:0xb994e670 @sign_type=:non_negative>
# /tmp/d20141028-18133-11j3717/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)>'
12) NumberSet can combine multiple filters with "or" rule
Failure/Error: filter = even | negative | more_than_100
NoMethodError:
undefined method `|' for #<Filter:0xb994d9dc @filter_proc=#<Proc:0xb994da40>>
# /tmp/d20141028-18133-11j3717/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)>'
13) NumberSet can combine multiple filters with "and" and "or" rules
Failure/Error: filter = even & negative | mod_3_is_zero
NoMethodError:
undefined method `&' for #<Filter:0xb994cd84 @filter_proc=#<Proc:0xb994da40>>
# /tmp/d20141028-18133-11j3717/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)>'
14) NumberSet can combine multiple filters with "and", "or" and parenthesis
Failure/Error: filter = even & (negative | mod_3_is_zero)
NoMethodError:
undefined method `|' for #<SignFilter:0xb994c1b8 @sign_type=:negative>
# /tmp/d20141028-18133-11j3717/spec.rb:138: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.02053 seconds
24 examples, 14 failures
Failed examples:
rspec /tmp/d20141028-18133-11j3717/spec.rb:42 # NumberSet can filter by complex type
rspec /tmp/d20141028-18133-11j3717/spec.rb:48 # NumberSet can filter by integer type
rspec /tmp/d20141028-18133-11j3717/spec.rb:54 # NumberSet can filter by real type
rspec /tmp/d20141028-18133-11j3717/spec.rb:60 # NumberSet can filter by custom filter
rspec /tmp/d20141028-18133-11j3717/spec.rb:66 # NumberSet can filter positive numbers
rspec /tmp/d20141028-18133-11j3717/spec.rb:72 # NumberSet can filter non-positive numbers
rspec /tmp/d20141028-18133-11j3717/spec.rb:78 # NumberSet can filter negative numbers
rspec /tmp/d20141028-18133-11j3717/spec.rb:84 # NumberSet can filter non-negative numbers
rspec /tmp/d20141028-18133-11j3717/spec.rb:90 # NumberSet can combine two filters with "and" rule
rspec /tmp/d20141028-18133-11j3717/spec.rb:97 # NumberSet can combine two filters with "or" rule
rspec /tmp/d20141028-18133-11j3717/spec.rb:104 # NumberSet can combine multiple filters with "and" rule
rspec /tmp/d20141028-18133-11j3717/spec.rb:114 # NumberSet can combine multiple filters with "or" rule
rspec /tmp/d20141028-18133-11j3717/spec.rb:124 # NumberSet can combine multiple filters with "and" and "or" rules
rspec /tmp/d20141028-18133-11j3717/spec.rb:134 # NumberSet can combine multiple filters with "and", "or" and parenthesis
История (2 версии и 1 коментар)
Любомир обнови решението на 26.10.2014 22:06 (преди около 10 години)
Любомир обнови решението на 27.10.2014 15:53 (преди около 10 години)