Решение на Втора задача от Иван Кавалджиев
Обратно към всички решения
Към профила на Иван Кавалджиев
Резултати
- 5 точки от тестове
- 0 бонус точки
- 5 точки общо
- 18 успешни тест(а)
- 6 неуспешни тест(а)
Код
Лог от изпълнението
........F.F......F.FFF..
Failures:
1) NumberSet can filter by complex type
Failure/Error: filtered_numbers = numbers[using]
NoMethodError:
undefined method `complex?' for (0.3+2i):Complex
# /tmp/d20141028-18133-a21xvf/solution.rb:56:in `filtered?'
# /tmp/d20141028-18133-a21xvf/solution.rb:25:in `block in []'
# /tmp/d20141028-18133-a21xvf/solution.rb:25:in `select'
# /tmp/d20141028-18133-a21xvf/solution.rb:25:in `[]'
# /tmp/d20141028-18133-a21xvf/spec.rb:179:in `can_filter'
# /tmp/d20141028-18133-a21xvf/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 real type
Failure/Error: expect(filtered_numbers.size).to eq expecting.size
expected: 2
got: 3
(compared using ==)
# /tmp/d20141028-18133-a21xvf/spec.rb:180:in `can_filter'
# /tmp/d20141028-18133-a21xvf/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)>'
3) NumberSet can combine two filters with "or" rule
Failure/Error: filter = Filter.new { |number| number % 2 == 0 } | Filter.new { |number| number > 5 }
ArgumentError:
wrong number of arguments (1 for 0)
# /tmp/d20141028-18133-a21xvf/solution.rb:42:in `|'
# /tmp/d20141028-18133-a21xvf/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)>'
4) NumberSet can combine multiple filters with "or" rule
Failure/Error: filter = even | negative | more_than_100
ArgumentError:
wrong number of arguments (1 for 0)
# /tmp/d20141028-18133-a21xvf/solution.rb:42:in `|'
# /tmp/d20141028-18133-a21xvf/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)>'
5) NumberSet can combine multiple filters with "and" and "or" rules
Failure/Error: filter = even & negative | mod_3_is_zero
ArgumentError:
wrong number of arguments (1 for 0)
# /tmp/d20141028-18133-a21xvf/solution.rb:42:in `|'
# /tmp/d20141028-18133-a21xvf/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)>'
6) NumberSet can combine multiple filters with "and", "or" and parenthesis
Failure/Error: filter = even & (negative | mod_3_is_zero)
ArgumentError:
wrong number of arguments (1 for 0)
# /tmp/d20141028-18133-a21xvf/solution.rb:42:in `|'
# /tmp/d20141028-18133-a21xvf/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.02209 seconds
24 examples, 6 failures
Failed examples:
rspec /tmp/d20141028-18133-a21xvf/spec.rb:42 # NumberSet can filter by complex type
rspec /tmp/d20141028-18133-a21xvf/spec.rb:54 # NumberSet can filter by real type
rspec /tmp/d20141028-18133-a21xvf/spec.rb:97 # NumberSet can combine two filters with "or" rule
rspec /tmp/d20141028-18133-a21xvf/spec.rb:114 # NumberSet can combine multiple filters with "or" rule
rspec /tmp/d20141028-18133-a21xvf/spec.rb:124 # NumberSet can combine multiple filters with "and" and "or" rules
rspec /tmp/d20141028-18133-a21xvf/spec.rb:134 # NumberSet can combine multiple filters with "and", "or" and parenthesis
История (3 версии и 2 коментара)
Иван обнови решението на 26.10.2014 00:21 (преди около 10 години)
Иван обнови решението на 26.10.2014 11:59 (преди около 10 години)
Иван обнови решението на 26.10.2014 22:39 (преди около 10 години)