Решение на Бонус задача: ArnoldC+- от Николина Гюрова
Обратно към всички решения
Към профила на Николина Гюрова
Резултати
- 5 точки от тестове
- 0 бонус точки
- 5 точки общо
- 14 успешни тест(а)
- 15 неуспешни тест(а)
Код
Лог от изпълнението
.....FFFFFFF.......F..FFFFFFF
Failures:
1) ArnoldCPM returns 0 by default
Failure/Error: talk_to_the_hand _invocation_result
Double "printer" received :print with unexpected arguments
expected: (0)
got: (nil)
# /tmp/d20170103-15620-loapfm/solution.rb:144:in `talk_to_the_hand'
# /tmp/d20170103-15620-loapfm/solution.rb:70:in `method_missing'
# /tmp/d20170103-15620-loapfm/spec.rb:535:in `block (3 levels) in <top (required)>'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `instance_eval'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `totally_recall'
# /tmp/d20170103-15620-loapfm/spec.rb:525:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
2) ArnoldCPM can take functions as arguments
Failure/Error: do_it_now _target_function
NoMethodError:
undefined method `[]' for nil:NilClass
# /tmp/d20170103-15620-loapfm/solution.rb:117:in `paramethers'
# /tmp/d20170103-15620-loapfm/solution.rb:104:in `do_it_now'
# /tmp/d20170103-15620-loapfm/spec.rb:572:in `block (3 levels) in <top (required)>'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `instance_eval'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `totally_recall'
# /tmp/d20170103-15620-loapfm/spec.rb:556:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
3) ArnoldCPM can return functions
Failure/Error: hasta_la_vista_baby
NoMethodError:
undefined method `[]' for nil:NilClass
# /tmp/d20170103-15620-loapfm/solution.rb:98:in `hasta_la_vista_baby'
# /tmp/d20170103-15620-loapfm/spec.rb:602:in `block (3 levels) in <top (required)>'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `instance_eval'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `totally_recall'
# /tmp/d20170103-15620-loapfm/spec.rb:593:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
4) ArnoldCPM defines new inner functions for each function invocation
Failure/Error: hasta_la_vista_baby
NoMethodError:
undefined method `[]' for nil:NilClass
# /tmp/d20170103-15620-loapfm/solution.rb:98:in `hasta_la_vista_baby'
# /tmp/d20170103-15620-loapfm/spec.rb:632:in `block (3 levels) in <top (required)>'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `instance_eval'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `totally_recall'
# /tmp/d20170103-15620-loapfm/spec.rb:625:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
5) ArnoldCPM supports basic recursion
Failure/Error: do_it_now _count, _next, _to
NoMethodError:
undefined method `[]' for nil:NilClass
# /tmp/d20170103-15620-loapfm/solution.rb:117:in `paramethers'
# /tmp/d20170103-15620-loapfm/solution.rb:104:in `do_it_now'
# /tmp/d20170103-15620-loapfm/spec.rb:686:in `block (3 levels) in <top (required)>'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `instance_eval'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `totally_recall'
# /tmp/d20170103-15620-loapfm/spec.rb:666:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
6) ArnoldCPM can calculate fibonacci(20) recursively
Failure/Error: do_it_now _fibonacci, _n_minus_one
NoMethodError:
undefined method `[]' for nil:NilClass
# /tmp/d20170103-15620-loapfm/solution.rb:117:in `paramethers'
# /tmp/d20170103-15620-loapfm/solution.rb:104:in `do_it_now'
# /tmp/d20170103-15620-loapfm/spec.rb:738:in `block (3 levels) in <top (required)>'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `instance_eval'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `totally_recall'
# /tmp/d20170103-15620-loapfm/spec.rb:714:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
7) ArnoldCPM can use closures in very convoluted ways
Failure/Error: do_it_now _func, _head, _tail
NoMethodError:
undefined method `[]' for nil:NilClass
# /tmp/d20170103-15620-loapfm/solution.rb:117:in `paramethers'
# /tmp/d20170103-15620-loapfm/solution.rb:104:in `do_it_now'
# /tmp/d20170103-15620-loapfm/spec.rb:777:in `block (3 levels) in <top (required)>'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `instance_eval'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `totally_recall'
# /tmp/d20170103-15620-loapfm/spec.rb:765:in `block (2 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
8) ArnoldCPM has boolean arithmetic that given *or* returns truthy values if one of the operands is truthy
Failure/Error: talk_to_the_hand _result
(Double "printer").print(0)
expected: 0 times with arguments: (0)
received: 1 time with arguments: (0)
# /tmp/d20170103-15620-loapfm/solution.rb:144:in `talk_to_the_hand'
# /tmp/d20170103-15620-loapfm/solution.rb:70:in `method_missing'
# /tmp/d20170103-15620-loapfm/spec.rb:206:in `block (4 levels) in <top (required)>'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `instance_eval'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `totally_recall'
# /tmp/d20170103-15620-loapfm/spec.rb:192:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
9) ArnoldCPM has boolean arithmetic that given *and* returns falsy values if either operand is falsy
Failure/Error: talk_to_the_hand _result
(Double "printer").print(1)
expected: 0 times with arguments: (1)
received: 1 time with arguments: (1)
# /tmp/d20170103-15620-loapfm/solution.rb:144:in `talk_to_the_hand'
# /tmp/d20170103-15620-loapfm/solution.rb:70:in `method_missing'
# /tmp/d20170103-15620-loapfm/spec.rb:268:in `block (4 levels) in <top (required)>'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `instance_eval'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `totally_recall'
# /tmp/d20170103-15620-loapfm/spec.rb:261:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
10) ArnoldCPM has boolean arithmetic that given *and* between two truthy values returns the second one
Failure/Error: talk_to_the_hand _result
(Double "printer").print(11)
expected: 0 times with arguments: (11)
received: 1 time with arguments: (11)
# /tmp/d20170103-15620-loapfm/solution.rb:144:in `talk_to_the_hand'
# /tmp/d20170103-15620-loapfm/solution.rb:70:in `method_missing'
# /tmp/d20170103-15620-loapfm/spec.rb:299:in `block (4 levels) in <top (required)>'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `instance_eval'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `totally_recall'
# /tmp/d20170103-15620-loapfm/spec.rb:292:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
11) ArnoldCPM has boolean arithmetic that has the same precedence of *or* and *and* operations
Failure/Error: talk_to_the_hand _result
(Double "printer").print(1)
expected: 0 times with arguments: (1)
received: 1 time with arguments: (1)
# /tmp/d20170103-15620-loapfm/solution.rb:144:in `talk_to_the_hand'
# /tmp/d20170103-15620-loapfm/solution.rb:70:in `method_missing'
# /tmp/d20170103-15620-loapfm/spec.rb:317:in `block (4 levels) in <top (required)>'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `instance_eval'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `totally_recall'
# /tmp/d20170103-15620-loapfm/spec.rb:309:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
12) ArnoldCPM has branching mechanism that can execute if statements
Failure/Error: expect(printer).to receive(:print).with(value_to_be_printed).ordered
(Double "printer").print(11)
expected: 1 time with arguments: (11)
received: 0 times with arguments: (11)
# /tmp/d20170103-15620-loapfm/spec.rb:878:in `block in expect_execution'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
13) ArnoldCPM has branching mechanism that can execute if-else statements
Failure/Error: you_have_no_respect_for_logic
(Double "printer").print(22)
expected: 0 times with arguments: (22)
received: 1 time with arguments: (22)
# /tmp/d20170103-15620-loapfm/solution.rb:142:in `talk_to_the_hand'
# /tmp/d20170103-15620-loapfm/solution.rb:64:in `block in you_have_no_respect_for_logic'
# /tmp/d20170103-15620-loapfm/solution.rb:63:in `each'
# /tmp/d20170103-15620-loapfm/solution.rb:63:in `you_have_no_respect_for_logic'
# /tmp/d20170103-15620-loapfm/spec.rb:367:in `block (4 levels) in <top (required)>'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `instance_eval'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `totally_recall'
# /tmp/d20170103-15620-loapfm/spec.rb:361:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
14) ArnoldCPM has branching mechanism that can nest if-else statements
Failure/Error: you_have_no_respect_for_logic
(Double "printer").print(44)
expected: 0 times with arguments: (44)
received: 1 time with arguments: (44)
# /tmp/d20170103-15620-loapfm/solution.rb:142:in `talk_to_the_hand'
# /tmp/d20170103-15620-loapfm/solution.rb:64:in `block in you_have_no_respect_for_logic'
# /tmp/d20170103-15620-loapfm/solution.rb:63:in `each'
# /tmp/d20170103-15620-loapfm/solution.rb:63:in `you_have_no_respect_for_logic'
# /tmp/d20170103-15620-loapfm/spec.rb:421:in `block (4 levels) in <top (required)>'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `instance_eval'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `totally_recall'
# /tmp/d20170103-15620-loapfm/spec.rb:408:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
15) ArnoldCPM has branching mechanism that considers functions truthy
Failure/Error: you_have_no_respect_for_logic
(Double "printer").print(22)
expected: 0 times with arguments: (22)
received: 1 time with arguments: (22)
# /tmp/d20170103-15620-loapfm/solution.rb:142:in `talk_to_the_hand'
# /tmp/d20170103-15620-loapfm/solution.rb:64:in `block in you_have_no_respect_for_logic'
# /tmp/d20170103-15620-loapfm/solution.rb:63:in `each'
# /tmp/d20170103-15620-loapfm/solution.rb:63:in `you_have_no_respect_for_logic'
# /tmp/d20170103-15620-loapfm/spec.rb:460:in `block (4 levels) in <top (required)>'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `instance_eval'
# /tmp/d20170103-15620-loapfm/solution.rb:6:in `totally_recall'
# /tmp/d20170103-15620-loapfm/spec.rb:451:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:7:in `block (2 levels) in <top (required)>'
Finished in 0.04135 seconds
29 examples, 15 failures
Failed examples:
rspec /tmp/d20170103-15620-loapfm/spec.rb:517 # ArnoldCPM returns 0 by default
rspec /tmp/d20170103-15620-loapfm/spec.rb:540 # ArnoldCPM can take functions as arguments
rspec /tmp/d20170103-15620-loapfm/spec.rb:583 # ArnoldCPM can return functions
rspec /tmp/d20170103-15620-loapfm/spec.rb:613 # ArnoldCPM defines new inner functions for each function invocation
rspec /tmp/d20170103-15620-loapfm/spec.rb:651 # ArnoldCPM supports basic recursion
rspec /tmp/d20170103-15620-loapfm/spec.rb:695 # ArnoldCPM can calculate fibonacci(20) recursively
rspec /tmp/d20170103-15620-loapfm/spec.rb:760 # ArnoldCPM can use closures in very convoluted ways
rspec /tmp/d20170103-15620-loapfm/spec.rb:183 # ArnoldCPM has boolean arithmetic that given *or* returns truthy values if one of the operands is truthy
rspec /tmp/d20170103-15620-loapfm/spec.rb:252 # ArnoldCPM has boolean arithmetic that given *and* returns falsy values if either operand is falsy
rspec /tmp/d20170103-15620-loapfm/spec.rb:287 # ArnoldCPM has boolean arithmetic that given *and* between two truthy values returns the second one
rspec /tmp/d20170103-15620-loapfm/spec.rb:304 # ArnoldCPM has boolean arithmetic that has the same precedence of *or* and *and* operations
rspec /tmp/d20170103-15620-loapfm/spec.rb:324 # ArnoldCPM has branching mechanism that can execute if statements
rspec /tmp/d20170103-15620-loapfm/spec.rb:347 # ArnoldCPM has branching mechanism that can execute if-else statements
rspec /tmp/d20170103-15620-loapfm/spec.rb:378 # ArnoldCPM has branching mechanism that can nest if-else statements
rspec /tmp/d20170103-15620-loapfm/spec.rb:441 # ArnoldCPM has branching mechanism that considers functions truthy
История (1 версия и 1 коментар)
Николина обнови решението на 28.12.2016 22:54 (преди почти 8 години)