Решение на Трета задача от Ивелина Христова
Обратно към всички решения
Към профила на Ивелина Христова
Резултати
- 2 точки от тестове
- 0 бонус точки
- 2 точки общо
- 5 успешни тест(а)
- 15 неуспешни тест(а)
Код
Лог от изпълнението
F.FFFFFF....FFFFFFFF
Failures:
1) Fifth task RationalSequence can calculate the first four rational numbers
Failure/Error: expect(RationalSequence.new(4).to_a).to eq %w(1/1 2/1 1/2 1/3).map(&:to_r)
expected: [(1/1), (2/1), (1/2), (1/3)]
got: [(1/1), (1/2), (2/1), (3/1)]
(compared using ==)
# /tmp/d20151111-27349-6ngr3c/spec.rb:4:in `block (3 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) Fifth task RationalSequence can calculate the first 28 rational numbers
Failure/Error: expect(RationalSequence.new(28).to_a).to eq %w(
expected: [(1/1), (2/1), (1/2), (1/3), (3/1), (4/1), (3/2), (2/3), (1/4), (1/5), (5/1), (6/1), (5/2), (4/3), (3/4), (2/5), (1/6), (1/7), (3/5), (5/3), (7/1), (8/1), (7/2), (5/4), (4/5), (2/7), (1/8), (1/9)]
got: [(1/1), (1/2), (2/1), (3/1), (1/3), (1/4), (2/3), (3/2), (4/1), (5/1), (1/5), (1/6), (2/5), (3/4), (4/3), (5/2), (6/1), (7/1), (5/3), (3/5), (1/7), (1/8), (2/7), (4/5), (5/4), (7/2), (8/1), (9/1)]
(compared using ==)
# /tmp/d20151111-27349-6ngr3c/spec.rb:12:in `block (3 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) Fifth task RationalSequence is properly enumerable
Failure/Error: expect(ones).to eq %w(1/1 1/2 1/3 1/4 1/5 1/6 1/7 1/8 1/9).map(&:to_r)
expected: [(1/1), (1/2), (1/3), (1/4), (1/5), (1/6), (1/7), (1/8), (1/9)]
got: [(1/1), (1/2), (1/3), (1/4), (1/5), (1/6), (1/7), (1/8)]
(compared using ==)
# /tmp/d20151111-27349-6ngr3c/spec.rb:20:in `block (3 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) Fifth task FibonacciSequence can return the first two Fibonacci numbers
Failure/Error: expect(FibonacciSequence.new(2).to_a).to eq [1, 1]
expected: [1, 1]
got: [0, 1]
(compared using ==)
# /tmp/d20151111-27349-6ngr3c/spec.rb:26:in `block (3 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) Fifth task FibonacciSequence can return the first 20 Fibonacci numbers
Failure/Error: expect(FibonacciSequence.new(20).to_a).to eq [
expected: [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765]
got: [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181]
(compared using ==)
# /tmp/d20151111-27349-6ngr3c/spec.rb:30:in `block (3 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) Fifth task FibonacciSequence can be used to calculate the Lucas numbers
Failure/Error: expect(FibonacciSequence.new(31, first: 2, second: 1).to_a).to eq [
ArgumentError:
wrong number of arguments (2 for 1)
# /tmp/d20151111-27349-6ngr3c/solution.rb:77:in `initialize'
# /tmp/d20151111-27349-6ngr3c/spec.rb:37:in `new'
# /tmp/d20151111-27349-6ngr3c/spec.rb:37:in `block (3 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) Fifth task FibonacciSequence is properly enumerable
Failure/Error: expect(FibonacciSequence.new(20).select { |x| x.even? }).to eq [
expected: [2, 8, 34, 144, 610, 2584]
got: [0, 2, 8, 34, 144, 610, 2584]
(compared using ==)
# /tmp/d20151111-27349-6ngr3c/spec.rb:45:in `block (3 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) Fifth task DrunkenMathematician #meaningless can calculate for 3
Failure/Error: expect(DrunkenMathematician.meaningless(4)).to eq Rational(1, 3)
expected: (1/3)
got: (3/1)
(compared using ==)
# /tmp/d20151111-27349-6ngr3c/spec.rb:78:in `block (4 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) Fifth task DrunkenMathematician #meaningless can calculate for 42
Failure/Error: expect(DrunkenMathematician.meaningless(42)).to eq Rational(1, 11)
expected: (1/11)
got: (11/1)
(compared using ==)
# /tmp/d20151111-27349-6ngr3c/spec.rb:82:in `block (4 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) Fifth task DrunkenMathematician #aimless can calculate for 3
Failure/Error: expect(DrunkenMathematician.aimless(3)).to eq(Rational(2, 3) + Rational(5, 1))
NoMethodError:
undefined method `aimless' for DrunkenMathematician:Module
# /tmp/d20151111-27349-6ngr3c/spec.rb:88:in `block (4 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) Fifth task DrunkenMathematician #aimless can calculate for 4
Failure/Error: expect(DrunkenMathematician.aimless(4)).to eq(Rational(2, 3) + Rational(5, 7))
NoMethodError:
undefined method `aimless' for DrunkenMathematician:Module
# /tmp/d20151111-27349-6ngr3c/spec.rb:92:in `block (4 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) Fifth task DrunkenMathematician #aimless can calculate for 42
Failure/Error: expect(DrunkenMathematician.aimless(42)).to eq expected
NoMethodError:
undefined method `aimless' for DrunkenMathematician:Module
# /tmp/d20151111-27349-6ngr3c/spec.rb:97:in `block (4 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) Fifth task DrunkenMathematician #worthless can calculate for 2
Failure/Error: expect(DrunkenMathematician.worthless(2)).to eq %w(1/1).map(&:to_r)
NoMethodError:
undefined method `worthless' for DrunkenMathematician:Module
# /tmp/d20151111-27349-6ngr3c/spec.rb:103:in `block (4 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) Fifth task DrunkenMathematician #worthless can calculate for 8
Failure/Error: expect(DrunkenMathematician.worthless(8)).to eq expected
NoMethodError:
undefined method `worthless' for DrunkenMathematician:Module
# /tmp/d20151111-27349-6ngr3c/spec.rb:108:in `block (4 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) Fifth task DrunkenMathematician #worthless can calculate for 15
Failure/Error: expect(DrunkenMathematician.worthless(15)).to eq %w(
NoMethodError:
undefined method `worthless' for DrunkenMathematician:Module
# /tmp/d20151111-27349-6ngr3c/spec.rb:112:in `block (4 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.01856 seconds
20 examples, 15 failures
Failed examples:
rspec /tmp/d20151111-27349-6ngr3c/spec.rb:3 # Fifth task RationalSequence can calculate the first four rational numbers
rspec /tmp/d20151111-27349-6ngr3c/spec.rb:11 # Fifth task RationalSequence can calculate the first 28 rational numbers
rspec /tmp/d20151111-27349-6ngr3c/spec.rb:18 # Fifth task RationalSequence is properly enumerable
rspec /tmp/d20151111-27349-6ngr3c/spec.rb:25 # Fifth task FibonacciSequence can return the first two Fibonacci numbers
rspec /tmp/d20151111-27349-6ngr3c/spec.rb:29 # Fifth task FibonacciSequence can return the first 20 Fibonacci numbers
rspec /tmp/d20151111-27349-6ngr3c/spec.rb:36 # Fifth task FibonacciSequence can be used to calculate the Lucas numbers
rspec /tmp/d20151111-27349-6ngr3c/spec.rb:44 # Fifth task FibonacciSequence is properly enumerable
rspec /tmp/d20151111-27349-6ngr3c/spec.rb:77 # Fifth task DrunkenMathematician #meaningless can calculate for 3
rspec /tmp/d20151111-27349-6ngr3c/spec.rb:81 # Fifth task DrunkenMathematician #meaningless can calculate for 42
rspec /tmp/d20151111-27349-6ngr3c/spec.rb:87 # Fifth task DrunkenMathematician #aimless can calculate for 3
rspec /tmp/d20151111-27349-6ngr3c/spec.rb:91 # Fifth task DrunkenMathematician #aimless can calculate for 4
rspec /tmp/d20151111-27349-6ngr3c/spec.rb:95 # Fifth task DrunkenMathematician #aimless can calculate for 42
rspec /tmp/d20151111-27349-6ngr3c/spec.rb:102 # Fifth task DrunkenMathematician #worthless can calculate for 2
rspec /tmp/d20151111-27349-6ngr3c/spec.rb:106 # Fifth task DrunkenMathematician #worthless can calculate for 8
rspec /tmp/d20151111-27349-6ngr3c/spec.rb:111 # Fifth task DrunkenMathematician #worthless can calculate for 15
История (1 версия и 1 коментар)
Ивелина обнови решението на 26.10.2015 04:39 (преди над 9 години)