Решение на Втора задача от Александър Пирнарев
Обратно към всички решения
Към профила на Александър Пирнарев
Резултати
- 0 точки от тестове
- 0 бонус точки
- 0 точки общо
- 0 успешни тест(а)
- 24 неуспешни тест(а)
Код
Лог от изпълнението
FFFFFFFFFFFFFFFFFFFFFFFF
Failures:
1) NumberSet can store integers
Failure/Error: numbers << number
NameError:
undefined local variable or method `numbers' for #<NumberSet:0xba479a68>
# /tmp/d20141028-18133-5e99f0/solution.rb:14:in `<<'
# /tmp/d20141028-18133-5e99f0/spec.rb:170:in `can_store'
# /tmp/d20141028-18133-5e99f0/spec.rb:3: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 store floating point numbers
Failure/Error: numbers << number
NameError:
undefined local variable or method `numbers' for #<NumberSet:0xba4788ac>
# /tmp/d20141028-18133-5e99f0/solution.rb:14:in `<<'
# /tmp/d20141028-18133-5e99f0/spec.rb:170:in `can_store'
# /tmp/d20141028-18133-5e99f0/spec.rb:7: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 store complex numbers
Failure/Error: numbers << number
NameError:
undefined local variable or method `numbers' for #<NumberSet:0xba477de4>
# /tmp/d20141028-18133-5e99f0/solution.rb:14:in `<<'
# /tmp/d20141028-18133-5e99f0/spec.rb:170:in `can_store'
# /tmp/d20141028-18133-5e99f0/spec.rb:11: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 store rational numbers
Failure/Error: numbers << number
NameError:
undefined local variable or method `numbers' for #<NumberSet:0xba477308>
# /tmp/d20141028-18133-5e99f0/solution.rb:14:in `<<'
# /tmp/d20141028-18133-5e99f0/spec.rb:170:in `can_store'
# /tmp/d20141028-18133-5e99f0/spec.rb:15: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 compare numbers of different types
Failure/Error: numbers << number
NameError:
undefined local variable or method `numbers' for #<NumberSet:0xba476840>
# /tmp/d20141028-18133-5e99f0/solution.rb:14:in `<<'
# /tmp/d20141028-18133-5e99f0/spec.rb:170:in `can_store'
# /tmp/d20141028-18133-5e99f0/spec.rb:19: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 starts as empty collection
Failure/Error: expect(numbers.size).to eq 0
NameError:
undefined local variable or method `numbers' for #<NumberSet:0xba475d78>
# /tmp/d20141028-18133-5e99f0/solution.rb:21:in `size'
# /tmp/d20141028-18133-5e99f0/spec.rb:24: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 contains multiple numbers
Failure/Error: numbers << Rational(22, 7)
NameError:
undefined local variable or method `numbers' for #<NumberSet:0xba475300>
# /tmp/d20141028-18133-5e99f0/solution.rb:14:in `<<'
# /tmp/d20141028-18133-5e99f0/spec.rb:29: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 contains only unique numbers
Failure/Error: numbers << Rational(22, 2)
NameError:
undefined local variable or method `numbers' for #<NumberSet:0xba474860>
# /tmp/d20141028-18133-5e99f0/solution.rb:14:in `<<'
# /tmp/d20141028-18133-5e99f0/spec.rb:37: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 filter by complex type
Failure/Error: can_filter [0.3+2i, 3.14, 11], using: TypeFilter.new(:complex),
NameError:
undefined local variable or method `numbers' for #<TypeFilter:0xba4f7d64>
# /tmp/d20141028-18133-5e99f0/solution.rb:76:in `initialize'
# /tmp/d20141028-18133-5e99f0/spec.rb:43:in `new'
# /tmp/d20141028-18133-5e99f0/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)>'
10) NumberSet can filter by integer type
Failure/Error: can_filter [Rational(5, 2), 8.0, 7, Rational(9, 1)], using: TypeFilter.new(:integer),
NameError:
undefined local variable or method `numbers' for #<TypeFilter:0xba4f72d8>
# /tmp/d20141028-18133-5e99f0/solution.rb:76:in `initialize'
# /tmp/d20141028-18133-5e99f0/spec.rb:49:in `new'
# /tmp/d20141028-18133-5e99f0/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)>'
11) NumberSet can filter by real type
Failure/Error: can_filter [Rational(5, 2), 8.3, 7], using: TypeFilter.new(:real),
NameError:
undefined local variable or method `numbers' for #<TypeFilter:0xba4f6824>
# /tmp/d20141028-18133-5e99f0/solution.rb:76:in `initialize'
# /tmp/d20141028-18133-5e99f0/spec.rb:55:in `new'
# /tmp/d20141028-18133-5e99f0/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)>'
12) NumberSet can filter by custom filter
Failure/Error: can_filter [Rational(5, 2), 7.6, 5], using: Filter.new { |number| number > 4 },
NameError:
undefined local variable or method `numbers' for #<Filter:0xba4f5d34>
# /tmp/d20141028-18133-5e99f0/solution.rb:47:in `initialize'
# /tmp/d20141028-18133-5e99f0/spec.rb:61:in `new'
# /tmp/d20141028-18133-5e99f0/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)>'
13) NumberSet can filter positive numbers
Failure/Error: can_filter [Rational(-5, 2), 7.6, 0], using: SignFilter.new(:positive),
NameError:
uninitialized constant SignFilter
# /tmp/d20141028-18133-5e99f0/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)>'
14) NumberSet can filter non-positive numbers
Failure/Error: can_filter [Rational(-5, 2), 7.6, 0], using: SignFilter.new(:non_positive),
NameError:
uninitialized constant SignFilter
# /tmp/d20141028-18133-5e99f0/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)>'
15) NumberSet can filter negative numbers
Failure/Error: can_filter [Rational(-5, 2), 7.6, 0], using: SignFilter.new(:negative),
NameError:
uninitialized constant SignFilter
# /tmp/d20141028-18133-5e99f0/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)>'
16) NumberSet can filter non-negative numbers
Failure/Error: can_filter [Rational(-5, 2), 7.6, 0], using: SignFilter.new(:non_negative),
NameError:
uninitialized constant SignFilter
# /tmp/d20141028-18133-5e99f0/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)>'
17) NumberSet can combine two filters with "and" rule
Failure/Error: filter = SignFilter.new(:non_negative) & Filter.new { |number| number != 0 }
NameError:
uninitialized constant SignFilter
# /tmp/d20141028-18133-5e99f0/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)>'
18) NumberSet can combine two filters with "or" rule
Failure/Error: filter = Filter.new { |number| number % 2 == 0 } | Filter.new { |number| number > 5 }
NameError:
undefined local variable or method `numbers' for #<Filter:0xba4b4c30>
# /tmp/d20141028-18133-5e99f0/solution.rb:47:in `initialize'
# /tmp/d20141028-18133-5e99f0/spec.rb:98:in `new'
# /tmp/d20141028-18133-5e99f0/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)>'
19) NumberSet can combine multiple filters with "and" rule
Failure/Error: non_negative = SignFilter.new(:non_negative)
NameError:
uninitialized constant SignFilter
# /tmp/d20141028-18133-5e99f0/spec.rb:105: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)>'
20) NumberSet can combine multiple filters with "or" rule
Failure/Error: even = Filter.new(&:even?)
NameError:
undefined local variable or method `numbers' for #<Filter:0xba4b2a20>
# /tmp/d20141028-18133-5e99f0/solution.rb:47:in `initialize'
# /tmp/d20141028-18133-5e99f0/spec.rb:115:in `new'
# /tmp/d20141028-18133-5e99f0/spec.rb:115: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)>'
21) NumberSet can combine multiple filters with "and" and "or" rules
Failure/Error: even = Filter.new(&:even?)
NameError:
undefined local variable or method `numbers' for #<Filter:0xba4b1f80>
# /tmp/d20141028-18133-5e99f0/solution.rb:47:in `initialize'
# /tmp/d20141028-18133-5e99f0/spec.rb:125:in `new'
# /tmp/d20141028-18133-5e99f0/spec.rb:125: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)>'
22) NumberSet can combine multiple filters with "and", "or" and parenthesis
Failure/Error: even = Filter.new(&:even?)
NameError:
undefined local variable or method `numbers' for #<Filter:0xba4b14f4>
# /tmp/d20141028-18133-5e99f0/solution.rb:47:in `initialize'
# /tmp/d20141028-18133-5e99f0/spec.rb:135:in `new'
# /tmp/d20141028-18133-5e99f0/spec.rb:135: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)>'
23) NumberSet is enumerable
Failure/Error: numbers << number
NameError:
undefined local variable or method `numbers' for #<NumberSet:0xba4b0a7c>
# /tmp/d20141028-18133-5e99f0/solution.rb:14:in `<<'
# /tmp/d20141028-18133-5e99f0/spec.rb:147:in `block (3 levels) in <top (required)>'
# /tmp/d20141028-18133-5e99f0/spec.rb:146:in `each'
# /tmp/d20141028-18133-5e99f0/spec.rb:146: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)>'
24) NumberSet returns enumerable of set's contents if no block is given to each
Failure/Error: numbers << number
NameError:
undefined local variable or method `numbers' for #<NumberSet:0xba45be14>
# /tmp/d20141028-18133-5e99f0/solution.rb:14:in `<<'
# /tmp/d20141028-18133-5e99f0/spec.rb:162:in `block (3 levels) in <top (required)>'
# /tmp/d20141028-18133-5e99f0/spec.rb:161:in `each'
# /tmp/d20141028-18133-5e99f0/spec.rb:161: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.02606 seconds
24 examples, 24 failures
Failed examples:
rspec /tmp/d20141028-18133-5e99f0/spec.rb:2 # NumberSet can store integers
rspec /tmp/d20141028-18133-5e99f0/spec.rb:6 # NumberSet can store floating point numbers
rspec /tmp/d20141028-18133-5e99f0/spec.rb:10 # NumberSet can store complex numbers
rspec /tmp/d20141028-18133-5e99f0/spec.rb:14 # NumberSet can store rational numbers
rspec /tmp/d20141028-18133-5e99f0/spec.rb:18 # NumberSet can compare numbers of different types
rspec /tmp/d20141028-18133-5e99f0/spec.rb:22 # NumberSet starts as empty collection
rspec /tmp/d20141028-18133-5e99f0/spec.rb:27 # NumberSet contains multiple numbers
rspec /tmp/d20141028-18133-5e99f0/spec.rb:35 # NumberSet contains only unique numbers
rspec /tmp/d20141028-18133-5e99f0/spec.rb:42 # NumberSet can filter by complex type
rspec /tmp/d20141028-18133-5e99f0/spec.rb:48 # NumberSet can filter by integer type
rspec /tmp/d20141028-18133-5e99f0/spec.rb:54 # NumberSet can filter by real type
rspec /tmp/d20141028-18133-5e99f0/spec.rb:60 # NumberSet can filter by custom filter
rspec /tmp/d20141028-18133-5e99f0/spec.rb:66 # NumberSet can filter positive numbers
rspec /tmp/d20141028-18133-5e99f0/spec.rb:72 # NumberSet can filter non-positive numbers
rspec /tmp/d20141028-18133-5e99f0/spec.rb:78 # NumberSet can filter negative numbers
rspec /tmp/d20141028-18133-5e99f0/spec.rb:84 # NumberSet can filter non-negative numbers
rspec /tmp/d20141028-18133-5e99f0/spec.rb:90 # NumberSet can combine two filters with "and" rule
rspec /tmp/d20141028-18133-5e99f0/spec.rb:97 # NumberSet can combine two filters with "or" rule
rspec /tmp/d20141028-18133-5e99f0/spec.rb:104 # NumberSet can combine multiple filters with "and" rule
rspec /tmp/d20141028-18133-5e99f0/spec.rb:114 # NumberSet can combine multiple filters with "or" rule
rspec /tmp/d20141028-18133-5e99f0/spec.rb:124 # NumberSet can combine multiple filters with "and" and "or" rules
rspec /tmp/d20141028-18133-5e99f0/spec.rb:134 # NumberSet can combine multiple filters with "and", "or" and parenthesis
rspec /tmp/d20141028-18133-5e99f0/spec.rb:144 # NumberSet is enumerable
rspec /tmp/d20141028-18133-5e99f0/spec.rb:159 # NumberSet returns enumerable of set's contents if no block is given to each
История (3 версии и 0 коментара)
Александър обнови решението на 27.10.2014 12:01 (преди около 10 години)
Александър обнови решението на 27.10.2014 12:08 (преди около 10 години)
Александър обнови решението на 27.10.2014 12:09 (преди около 10 години)