Решение на Осма задача от Алекс Николов
Обратно към всички решения
Към профила на Алекс Николов
Резултати
- 4 точки от тестове
- 0 бонус точки
- 4 точки общо
- 27 успешни тест(а)
- 13 неуспешни тест(а)
Код
Лог от изпълнението
FF..F.......F.....F...FFFF..F..F.F.....F
Failures:
1) Spreadsheet#new can be called with no arguments or with a single string argument
Failure/Error: Spreadsheet.new
NoMethodError:
undefined method `lstrip' for nil:NilClass
# /tmp/d20160121-5693-1a68qzj/solution.rb:141:in `parse_table'
# /tmp/d20160121-5693-1a68qzj/solution.rb:7:in `initialize'
# /tmp/d20160121-5693-1a68qzj/spec.rb:4:in `new'
# /tmp/d20160121-5693-1a68qzj/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) Spreadsheet#new creates a blank sheet when no arguments are passed
Failure/Error: expect(Spreadsheet.new).to be_empty
NoMethodError:
undefined method `lstrip' for nil:NilClass
# /tmp/d20160121-5693-1a68qzj/solution.rb:141:in `parse_table'
# /tmp/d20160121-5693-1a68qzj/solution.rb:7:in `initialize'
# /tmp/d20160121-5693-1a68qzj/spec.rb:10:in `new'
# /tmp/d20160121-5693-1a68qzj/spec.rb:10: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) Spreadsheet#to_s returns blank tables as blank strings
Failure/Error: expect(Spreadsheet.new.to_s).to eq ''
NoMethodError:
undefined method `lstrip' for nil:NilClass
# /tmp/d20160121-5693-1a68qzj/solution.rb:141:in `parse_table'
# /tmp/d20160121-5693-1a68qzj/solution.rb:7:in `initialize'
# /tmp/d20160121-5693-1a68qzj/spec.rb:24:in `new'
# /tmp/d20160121-5693-1a68qzj/spec.rb:24: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) Spreadsheet#[] raises an exception for non-existant cells
Failure/Error: expect { Spreadsheet.new()['A1'] }.to raise_error(Spreadsheet::Error, /Cell 'A1' does not exist/)
expected Spreadsheet::Error with message matching /Cell 'A1' does not exist/, got #<NoMethodError: undefined method `lstrip' for nil:NilClass> with backtrace:
# /tmp/d20160121-5693-1a68qzj/solution.rb:141:in `parse_table'
# /tmp/d20160121-5693-1a68qzj/solution.rb:7:in `initialize'
# /tmp/d20160121-5693-1a68qzj/spec.rb:75:in `new'
# /tmp/d20160121-5693-1a68qzj/spec.rb:75:in `block (4 levels) in <top (required)>'
# /tmp/d20160121-5693-1a68qzj/spec.rb:75: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)>'
# /tmp/d20160121-5693-1a68qzj/spec.rb:75: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) Spreadsheet#[] raises an exception for less than two arguments passed to ADD
Failure/Error: expect { Spreadsheet.new('=ADD(1)')['A1'] }.to raise_error(
expected Spreadsheet::Error with message matching /Wrong number of arguments for 'ADD': expected at least 2, got 1/, got #<Spreadsheet::Error: Wrong number of arguments for 'FOO': expected at least 2, got 1> with backtrace:
# /tmp/d20160121-5693-1a68qzj/solution.rb:116:in `argument_size_error'
# /tmp/d20160121-5693-1a68qzj/solution.rb:101:in `argument_number_error'
# /tmp/d20160121-5693-1a68qzj/solution.rb:31:in `[]'
# /tmp/d20160121-5693-1a68qzj/spec.rb:119:in `block (4 levels) in <top (required)>'
# /tmp/d20160121-5693-1a68qzj/spec.rb:119: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)>'
# /tmp/d20160121-5693-1a68qzj/spec.rb:119: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) Spreadsheet#[] raises an exception for less than two arguments to MULTIPLY
Failure/Error: expect { Spreadsheet.new('=MULTIPLY(1)')['A1'] }.to raise_error(
expected Spreadsheet::Error with message matching /Wrong number of arguments for 'MULTIPLY': expected at least 2, got 1/, got #<Spreadsheet::Error: Wrong number of arguments for 'FOO': expected at least 2, got 1> with backtrace:
# /tmp/d20160121-5693-1a68qzj/solution.rb:116:in `argument_size_error'
# /tmp/d20160121-5693-1a68qzj/solution.rb:101:in `argument_number_error'
# /tmp/d20160121-5693-1a68qzj/solution.rb:31:in `[]'
# /tmp/d20160121-5693-1a68qzj/spec.rb:149:in `block (4 levels) in <top (required)>'
# /tmp/d20160121-5693-1a68qzj/spec.rb:149: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)>'
# /tmp/d20160121-5693-1a68qzj/spec.rb:149: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) Spreadsheet#[] subtracts two numbers with SUBTRACT
Failure/Error: expect(sheet['A1']).to eq('2')
Spreadsheet::Error:
Unknown function 'SUBTRACT'
# /tmp/d20160121-5693-1a68qzj/solution.rb:81:in `unknown_function_error'
# /tmp/d20160121-5693-1a68qzj/solution.rb:29:in `[]'
# /tmp/d20160121-5693-1a68qzj/spec.rb:161: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) Spreadsheet#[] subtracts numbers via cell references
Failure/Error: expect(sheet['D1']).to eq('4')
Spreadsheet::Error:
Unknown function 'SUBTRACT'
# /tmp/d20160121-5693-1a68qzj/solution.rb:81:in `unknown_function_error'
# /tmp/d20160121-5693-1a68qzj/solution.rb:29:in `[]'
# /tmp/d20160121-5693-1a68qzj/spec.rb:167: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)>'
9) Spreadsheet#[] raises an exception when SUBTRACT is called with a wrong number of arguments
Failure/Error: expect { Spreadsheet.new('=SUBTRACT(1)')['A1'] }.to raise_error(
expected Spreadsheet::Error with message matching /Wrong number of arguments for 'SUBTRACT': expected 2, got 1/, got #<Spreadsheet::Error: Unknown function 'SUBTRACT'> with backtrace:
# /tmp/d20160121-5693-1a68qzj/solution.rb:81:in `unknown_function_error'
# /tmp/d20160121-5693-1a68qzj/solution.rb:29:in `[]'
# /tmp/d20160121-5693-1a68qzj/spec.rb:171:in `block (4 levels) in <top (required)>'
# /tmp/d20160121-5693-1a68qzj/spec.rb:171: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)>'
# /tmp/d20160121-5693-1a68qzj/spec.rb:171: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)>'
10) Spreadsheet#[] raises an exception when DIVIDE is called with a wrong number of arguments
Failure/Error: expect { Spreadsheet.new('=DIVIDE(1)')['A1'] }.to raise_error(
expected Spreadsheet::Error with message matching /Wrong number of arguments for 'DIVIDE': expected 2, got 1/, got #<Spreadsheet::Error: Wrong number of arguments for 'FOO': expected 2, got 1> with backtrace:
# /tmp/d20160121-5693-1a68qzj/solution.rb:116:in `argument_size_error'
# /tmp/d20160121-5693-1a68qzj/solution.rb:103:in `argument_number_error'
# /tmp/d20160121-5693-1a68qzj/solution.rb:31:in `[]'
# /tmp/d20160121-5693-1a68qzj/spec.rb:195:in `block (4 levels) in <top (required)>'
# /tmp/d20160121-5693-1a68qzj/spec.rb:195: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)>'
# /tmp/d20160121-5693-1a68qzj/spec.rb:195: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)>'
11) Spreadsheet#[] raises an exception when MOD is called with a wrong number of arguments
Failure/Error: expect { Spreadsheet.new('=MOD(1)')['A1'] }.to raise_error(
expected Spreadsheet::Error with message matching /Wrong number of arguments for 'MOD': expected 2, got 1/, got #<Spreadsheet::Error: Wrong number of arguments for 'FOO': expected 2, got 1> with backtrace:
# /tmp/d20160121-5693-1a68qzj/solution.rb:116:in `argument_size_error'
# /tmp/d20160121-5693-1a68qzj/solution.rb:103:in `argument_number_error'
# /tmp/d20160121-5693-1a68qzj/solution.rb:31:in `[]'
# /tmp/d20160121-5693-1a68qzj/spec.rb:219:in `block (4 levels) in <top (required)>'
# /tmp/d20160121-5693-1a68qzj/spec.rb:219: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)>'
# /tmp/d20160121-5693-1a68qzj/spec.rb:219: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)>'
12) Spreadsheet#[] subtracts floating point numbers with SUBTRACT
Failure/Error: expect(Spreadsheet.new('10 =SUBTRACT(A1, 1.1)')['B1']).to eq '8.90'
Spreadsheet::Error:
Unknown function 'SUBTRACT'
# /tmp/d20160121-5693-1a68qzj/solution.rb:81:in `unknown_function_error'
# /tmp/d20160121-5693-1a68qzj/solution.rb:29:in `[]'
# /tmp/d20160121-5693-1a68qzj/spec.rb:234: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)>'
13) Spreadsheet#[] raises an exception for invalid expressions
Failure/Error: expect { Spreadsheet.new('=FOO 100')['A1'] }.to raise_error(
expected Spreadsheet::Error with message matching /Invalid expression 'FOO'/, got #<NoMethodError: undefined method `[]' for nil:NilClass> with backtrace:
# /tmp/d20160121-5693-1a68qzj/solution.rb:80:in `unknown_function_error'
# /tmp/d20160121-5693-1a68qzj/solution.rb:29:in `[]'
# /tmp/d20160121-5693-1a68qzj/spec.rb:266:in `block (4 levels) in <top (required)>'
# /tmp/d20160121-5693-1a68qzj/spec.rb:266: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)>'
# /tmp/d20160121-5693-1a68qzj/spec.rb:266: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)>'
Finished in 0.11178 seconds
40 examples, 13 failures
Failed examples:
rspec /tmp/d20160121-5693-1a68qzj/spec.rb:3 # Spreadsheet#new can be called with no arguments or with a single string argument
rspec /tmp/d20160121-5693-1a68qzj/spec.rb:9 # Spreadsheet#new creates a blank sheet when no arguments are passed
rspec /tmp/d20160121-5693-1a68qzj/spec.rb:23 # Spreadsheet#to_s returns blank tables as blank strings
rspec /tmp/d20160121-5693-1a68qzj/spec.rb:74 # Spreadsheet#[] raises an exception for non-existant cells
rspec /tmp/d20160121-5693-1a68qzj/spec.rb:118 # Spreadsheet#[] raises an exception for less than two arguments passed to ADD
rspec /tmp/d20160121-5693-1a68qzj/spec.rb:148 # Spreadsheet#[] raises an exception for less than two arguments to MULTIPLY
rspec /tmp/d20160121-5693-1a68qzj/spec.rb:158 # Spreadsheet#[] subtracts two numbers with SUBTRACT
rspec /tmp/d20160121-5693-1a68qzj/spec.rb:164 # Spreadsheet#[] subtracts numbers via cell references
rspec /tmp/d20160121-5693-1a68qzj/spec.rb:170 # Spreadsheet#[] raises an exception when SUBTRACT is called with a wrong number of arguments
rspec /tmp/d20160121-5693-1a68qzj/spec.rb:194 # Spreadsheet#[] raises an exception when DIVIDE is called with a wrong number of arguments
rspec /tmp/d20160121-5693-1a68qzj/spec.rb:218 # Spreadsheet#[] raises an exception when MOD is called with a wrong number of arguments
rspec /tmp/d20160121-5693-1a68qzj/spec.rb:233 # Spreadsheet#[] subtracts floating point numbers with SUBTRACT
rspec /tmp/d20160121-5693-1a68qzj/spec.rb:265 # Spreadsheet#[] raises an exception for invalid expressions
История (5 версии и 0 коментара)
Алекс обнови решението на 06.01.2016 20:39 (преди над 9 години)
Алекс обнови решението на 09.01.2016 17:38 (преди над 9 години)
Алекс обнови решението на 09.01.2016 18:32 (преди над 9 години)
Алекс обнови решението на 09.01.2016 18:32 (преди над 9 години)
Алекс обнови решението на 10.01.2016 12:42 (преди над 9 години)