Мемоизация
- Краен срок
- 17.11.2013 12:00
Срокът за предаване на решения е отминал
Мемоизация
Създайте клас Memoizer
, чийто конструктор приема като единствен аргумент
какъвто и да е обект. Memoizer
трябва да работи като прокси, тоест трябва да:
...отговаря на същите методи, като подадената инстанция и когато тези методи
бъдат извикани, да връщат същите стойности, каквито биха върнали, ако бяха
извикани директно върху инстанцията и тъй нататък.
Memoizer
трябва също така да кешира резултатите от извиканите му методи и при
повторно извикване на вече извикан метод със същите аргументи, да не се обръща
към методите на подадената инстанция, а да връща резултата от кеша си.
Пример:
string = "Remember"
memoizer = Memoizer.new string
memoizer.length # => 8, извиква string.length
memoizer.length # => 8, не вика string.length
Уточнения:
-
Memoizer
не кешира резултати за методи, на които е подаден блок.
Вместо това, в такива случаи се държи като обикновено прокси.
- Ако
Memoizer
бъде извикан с несъществуващ в подадената
инстанция метод, очаквано следва да се хвърли NoMethodError
.
-
Memoizer
ще бъде тестван само с public
методи. Какво трябва да прави в
други случаи, според вас, може да се обсъди в темата във форума. :-)
- Ако примерният тест ви се струва постничък, то бъдете сигурни, че това е
нарочно и повече няма да получите. :-)
Решения
-
Коректно
- 6 успешни тест(а)
- 0 неуспешни тест(а)
Георги Шопов
......
Finished in 0.01284 seconds
6 examples, 0 failures
-
Некоректно
- 5 успешни тест(а)
- 1 неуспешни тест(а)
Георги Ангелов
....F.
Failures:
1) Memoizer works with nil return values
Failure/Error: call_count.should eq 1
expected: 1
got: 2
(compared using ==)
# /tmp/d20131117-20795-5zatrf/spec.rb:48: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.0152 seconds
6 examples, 1 failure
Failed examples:
rspec /tmp/d20131117-20795-5zatrf/spec.rb:35 # Memoizer works with nil return values
-
Коректно
- 6 успешни тест(а)
- 0 неуспешни тест(а)
Георги Кръстев
......
Finished in 0.01184 seconds
6 examples, 0 failures
-
Коректно
- 6 успешни тест(а)
- 0 неуспешни тест(а)
Стефан Василев
......
Finished in 0.01118 seconds
6 examples, 0 failures
-
Некоректно
- 5 успешни тест(а)
- 1 неуспешни тест(а)
Деян Хаджиев
....F.
Failures:
1) Memoizer works with nil return values
Failure/Error: call_count.should eq 1
expected: 1
got: 2
(compared using ==)
# /tmp/d20131117-20795-17exk7s/spec.rb:48: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.01439 seconds
6 examples, 1 failure
Failed examples:
rspec /tmp/d20131117-20795-17exk7s/spec.rb:35 # Memoizer works with nil return values
-
Коректно
- 6 успешни тест(а)
- 0 неуспешни тест(а)
Емануела Моллова
......
Finished in 0.01303 seconds
6 examples, 0 failures
-
Некоректно
- 5 успешни тест(а)
- 1 неуспешни тест(а)
Красимира Божанова
....F.
Failures:
1) Memoizer works with nil return values
Failure/Error: call_count.should eq 1
expected: 1
got: 2
(compared using ==)
# /tmp/d20131117-20795-er6xx1/spec.rb:48: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.01128 seconds
6 examples, 1 failure
Failed examples:
rspec /tmp/d20131117-20795-er6xx1/spec.rb:35 # Memoizer works with nil return values
-
Коректно
- 6 успешни тест(а)
- 0 неуспешни тест(а)
Калоян Калудов
......
Finished in 0.01262 seconds
6 examples, 0 failures
-
Коректно
- 6 успешни тест(а)
- 0 неуспешни тест(а)
Никола Ненков
......
Finished in 0.01344 seconds
6 examples, 0 failures
-
Некоректно
- 5 успешни тест(а)
- 1 неуспешни тест(а)
Александър Попов
....F.
Failures:
1) Memoizer works with nil return values
Failure/Error: call_count.should eq 1
expected: 1
got: 2
(compared using ==)
# /tmp/d20131117-20795-15inmli/spec.rb:48: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.01166 seconds
6 examples, 1 failure
Failed examples:
rspec /tmp/d20131117-20795-15inmli/spec.rb:35 # Memoizer works with nil return values
-
Коректно
- 6 успешни тест(а)
- 0 неуспешни тест(а)
Мария Митева
......
Finished in 0.01151 seconds
6 examples, 0 failures
-
Коректно
- 6 успешни тест(а)
- 0 неуспешни тест(а)
Росен Рачев
......
Finished in 0.01216 seconds
6 examples, 0 failures
-
Некоректно
- 5 успешни тест(а)
- 1 неуспешни тест(а)
Ангел Цанев
.F....
Failures:
1) Memoizer raises NoMethodError when an unknown method is called
Failure/Error: -> { memoizer.no_such_string_method }.should raise_error NoMethodError
expected NoMethodError, got #<NameError: uninitialized constant Memoizer::NoМethodError> with backtrace:
# /tmp/d20131117-20795-1r3hl1j/solution.rb:23:in `method_missing'
# /tmp/d20131117-20795-1r3hl1j/spec.rb:12:in `block (3 levels) in <top (required)>'
# /tmp/d20131117-20795-1r3hl1j/spec.rb:12: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)>'
# /tmp/d20131117-20795-1r3hl1j/spec.rb:12: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.01187 seconds
6 examples, 1 failure
Failed examples:
rspec /tmp/d20131117-20795-1r3hl1j/spec.rb:9 # Memoizer raises NoMethodError when an unknown method is called
-
Некоректно
- 3 успешни тест(а)
- 3 неуспешни тест(а)
Георги Пурнаров
..FFF.
Failures:
1) Memoizer memoizes results
Failure/Error: call_count.should eq 1
expected: 1
got: 2
(compared using ==)
# /tmp/d20131117-20795-13adqwg/spec.rb:28: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) Memoizer returns the actual class of the target object
Failure/Error: Memoizer.new(Object.new).class.should eq Object
expected: Object
got: Memoizer
(compared using ==)
Diff:
@@ -1,2 +1,2 @@
-Object
+Memoizer
# /tmp/d20131117-20795-13adqwg/spec.rb:32: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) Memoizer works with nil return values
Failure/Error: call_count.should eq 1
expected: 1
got: 4
(compared using ==)
# /tmp/d20131117-20795-13adqwg/spec.rb:48: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.01534 seconds
6 examples, 3 failures
Failed examples:
rspec /tmp/d20131117-20795-13adqwg/spec.rb:15 # Memoizer memoizes results
rspec /tmp/d20131117-20795-13adqwg/spec.rb:31 # Memoizer returns the actual class of the target object
rspec /tmp/d20131117-20795-13adqwg/spec.rb:35 # Memoizer works with nil return values
-
Коректно
- 6 успешни тест(а)
- 0 неуспешни тест(а)
Марио Даскалов
......
Finished in 0.01436 seconds
6 examples, 0 failures
-
Коректно
- 6 успешни тест(а)
- 0 неуспешни тест(а)
Давид Петров
......
Finished in 0.0135 seconds
6 examples, 0 failures
-
Коректно
- 6 успешни тест(а)
- 0 неуспешни тест(а)
Илия Ватахов
......
Finished in 0.01191 seconds
6 examples, 0 failures
-
Некоректно
- 4 успешни тест(а)
- 2 неуспешни тест(а)
Антонио Николов
..F.F.
Failures:
1) Memoizer memoizes results
Failure/Error: call_count.should eq 1
expected: 1
got: 2
(compared using ==)
# /tmp/d20131117-20795-1jwuily/spec.rb:28: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) Memoizer works with nil return values
Failure/Error: call_count.should eq 1
expected: 1
got: 2
(compared using ==)
# /tmp/d20131117-20795-1jwuily/spec.rb:48: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.01142 seconds
6 examples, 2 failures
Failed examples:
rspec /tmp/d20131117-20795-1jwuily/spec.rb:15 # Memoizer memoizes results
rspec /tmp/d20131117-20795-1jwuily/spec.rb:35 # Memoizer works with nil return values
-
Некоректно
- 4 успешни тест(а)
- 2 неуспешни тест(а)
Слав Керемидчиев
..F.F.
Failures:
1) Memoizer memoizes results
Failure/Error: call_count.should eq 1
expected: 1
got: 2
(compared using ==)
# /tmp/d20131117-20795-1c672f/spec.rb:28: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) Memoizer works with nil return values
Failure/Error: call_count.should eq 1
expected: 1
got: 2
(compared using ==)
# /tmp/d20131117-20795-1c672f/spec.rb:48: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.01447 seconds
6 examples, 2 failures
Failed examples:
rspec /tmp/d20131117-20795-1c672f/spec.rb:15 # Memoizer memoizes results
rspec /tmp/d20131117-20795-1c672f/spec.rb:35 # Memoizer works with nil return values
-
Коректно
- 6 успешни тест(а)
- 0 неуспешни тест(а)
Иван Капукаранов
......
Finished in 0.01183 seconds
6 examples, 0 failures
-
Коректно
- 6 успешни тест(а)
- 0 неуспешни тест(а)
Моника Димитрова
......
Finished in 0.01255 seconds
6 examples, 0 failures
-
Некоректно
- 5 успешни тест(а)
- 1 неуспешни тест(а)
Мария Терзиева
....F.
Failures:
1) Memoizer works with nil return values
Failure/Error: call_count.should eq 1
expected: 1
got: 2
(compared using ==)
# /tmp/d20131117-20795-vv3mi9/spec.rb:48: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.01516 seconds
6 examples, 1 failure
Failed examples:
rspec /tmp/d20131117-20795-vv3mi9/spec.rb:35 # Memoizer works with nil return values
-
Коректно
- 6 успешни тест(а)
- 0 неуспешни тест(а)
Диан Николов
......
Finished in 0.01584 seconds
6 examples, 0 failures
-
Некоректно
- 0 успешни тест(а)
- 6 неуспешни тест(а)
Веселин Генадиев
FFFFFF
Failures:
1) Memoizer calls the methods of the target class
Failure/Error: memoizer = Memoizer.new string
NameError:
uninitialized constant Memoizer
# /tmp/d20131117-20795-1cw0ly9/spec.rb:4: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) Memoizer raises NoMethodError when an unknown method is called
Failure/Error: memoizer = Memoizer.new "A string"
NameError:
uninitialized constant Memoizer
# /tmp/d20131117-20795-1cw0ly9/spec.rb:10: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) Memoizer memoizes results
Failure/Error: memoized = Memoizer.new object
NameError:
uninitialized constant Memoizer
# /tmp/d20131117-20795-1cw0ly9/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)>'
4) Memoizer returns the actual class of the target object
Failure/Error: Memoizer.new(Object.new).class.should eq Object
NameError:
uninitialized constant Memoizer
# /tmp/d20131117-20795-1cw0ly9/spec.rb:32: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) Memoizer works with nil return values
Failure/Error: memoized = Memoizer.new object
NameError:
uninitialized constant Memoizer
# /tmp/d20131117-20795-1cw0ly9/spec.rb:44: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) Memoizer works with blocks
Failure/Error: memoized = Memoizer.new array
NameError:
uninitialized constant Memoizer
# /tmp/d20131117-20795-1cw0ly9/spec.rb:56: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.01756 seconds
6 examples, 6 failures
Failed examples:
rspec /tmp/d20131117-20795-1cw0ly9/spec.rb:2 # Memoizer calls the methods of the target class
rspec /tmp/d20131117-20795-1cw0ly9/spec.rb:9 # Memoizer raises NoMethodError when an unknown method is called
rspec /tmp/d20131117-20795-1cw0ly9/spec.rb:15 # Memoizer memoizes results
rspec /tmp/d20131117-20795-1cw0ly9/spec.rb:31 # Memoizer returns the actual class of the target object
rspec /tmp/d20131117-20795-1cw0ly9/spec.rb:35 # Memoizer works with nil return values
rspec /tmp/d20131117-20795-1cw0ly9/spec.rb:51 # Memoizer works with blocks
-
Некоректно
- 4 успешни тест(а)
- 2 неуспешни тест(а)
Венцислав Велков
..F.F.
Failures:
1) Memoizer memoizes results
Failure/Error: call_count.should eq 1
expected: 1
got: 2
(compared using ==)
# /tmp/d20131117-20795-lkxu0v/spec.rb:28: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) Memoizer works with nil return values
Failure/Error: call_count.should eq 1
expected: 1
got: 2
(compared using ==)
# /tmp/d20131117-20795-lkxu0v/spec.rb:48: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.01264 seconds
6 examples, 2 failures
Failed examples:
rspec /tmp/d20131117-20795-lkxu0v/spec.rb:15 # Memoizer memoizes results
rspec /tmp/d20131117-20795-lkxu0v/spec.rb:35 # Memoizer works with nil return values
-
Некоректно
- 5 успешни тест(а)
- 1 неуспешни тест(а)
Валентин Ейткен
....F.
Failures:
1) Memoizer works with nil return values
Failure/Error: call_count.should eq 1
expected: 1
got: 2
(compared using ==)
# /tmp/d20131117-20795-jxvwxd/spec.rb:48: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.01426 seconds
6 examples, 1 failure
Failed examples:
rspec /tmp/d20131117-20795-jxvwxd/spec.rb:35 # Memoizer works with nil return values
-
Некоректно
- 0 успешни тест(а)
- 6 неуспешни тест(а)
Иван Латунов
FFFFFF
Failures:
1) Memoizer calls the methods of the target class
Failure/Error: memoizer = Memoizer.new string
NameError:
uninitialized constant Memoizer
# /tmp/d20131117-20795-3qq9pr/spec.rb:4: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) Memoizer raises NoMethodError when an unknown method is called
Failure/Error: memoizer = Memoizer.new "A string"
NameError:
uninitialized constant Memoizer
# /tmp/d20131117-20795-3qq9pr/spec.rb:10: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) Memoizer memoizes results
Failure/Error: memoized = Memoizer.new object
NameError:
uninitialized constant Memoizer
# /tmp/d20131117-20795-3qq9pr/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)>'
4) Memoizer returns the actual class of the target object
Failure/Error: Memoizer.new(Object.new).class.should eq Object
NameError:
uninitialized constant Memoizer
# /tmp/d20131117-20795-3qq9pr/spec.rb:32: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) Memoizer works with nil return values
Failure/Error: memoized = Memoizer.new object
NameError:
uninitialized constant Memoizer
# /tmp/d20131117-20795-3qq9pr/spec.rb:44: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) Memoizer works with blocks
Failure/Error: memoized = Memoizer.new array
NameError:
uninitialized constant Memoizer
# /tmp/d20131117-20795-3qq9pr/spec.rb:56: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.01376 seconds
6 examples, 6 failures
Failed examples:
rspec /tmp/d20131117-20795-3qq9pr/spec.rb:2 # Memoizer calls the methods of the target class
rspec /tmp/d20131117-20795-3qq9pr/spec.rb:9 # Memoizer raises NoMethodError when an unknown method is called
rspec /tmp/d20131117-20795-3qq9pr/spec.rb:15 # Memoizer memoizes results
rspec /tmp/d20131117-20795-3qq9pr/spec.rb:31 # Memoizer returns the actual class of the target object
rspec /tmp/d20131117-20795-3qq9pr/spec.rb:35 # Memoizer works with nil return values
rspec /tmp/d20131117-20795-3qq9pr/spec.rb:51 # Memoizer works with blocks
-
Коректно
- 6 успешни тест(а)
- 0 неуспешни тест(а)
Николай Хубанов
......
Finished in 0.01388 seconds
6 examples, 0 failures
-
Коректно
- 6 успешни тест(а)
- 0 неуспешни тест(а)
Петър Мазълов
......
Finished in 0.01422 seconds
6 examples, 0 failures
-
Коректно
- 6 успешни тест(а)
- 0 неуспешни тест(а)
Ангел Венчев
length from method
.. foo from method
foo from cache
. class from method
. foo from method
foo from cache
. each from method
each from method
.
Finished in 0.01473 seconds
6 examples, 0 failures
-
Некоректно
- 4 успешни тест(а)
- 2 неуспешни тест(а)
Кристиян Кисимов
..F.F.
Failures:
1) Memoizer memoizes results
Failure/Error: call_count.should eq 1
expected: 1
got: 2
(compared using ==)
# /tmp/d20131117-20795-1c9c4gl/spec.rb:28: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) Memoizer works with nil return values
Failure/Error: call_count.should eq 1
expected: 1
got: 2
(compared using ==)
# /tmp/d20131117-20795-1c9c4gl/spec.rb:48: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.01218 seconds
6 examples, 2 failures
Failed examples:
rspec /tmp/d20131117-20795-1c9c4gl/spec.rb:15 # Memoizer memoizes results
rspec /tmp/d20131117-20795-1c9c4gl/spec.rb:35 # Memoizer works with nil return values
-
Коректно
- 6 успешни тест(а)
- 0 неуспешни тест(а)
Борислава Аладжова
......
Finished in 0.01095 seconds
6 examples, 0 failures
-
Некоректно
- 5 успешни тест(а)
- 1 неуспешни тест(а)
Ясен Трифонов
.F....
Failures:
1) Memoizer raises NoMethodError when an unknown method is called
Failure/Error: -> { memoizer.no_such_string_method }.should raise_error NoMethodError
expected NoMethodError, got #<NameError: uninitialized constant Memoizer::NoMethodError> with backtrace:
# /tmp/d20131117-20795-1lhx3ms/solution.rb:23:in `method_missing'
# /tmp/d20131117-20795-1lhx3ms/spec.rb:12:in `block (3 levels) in <top (required)>'
# /tmp/d20131117-20795-1lhx3ms/spec.rb:12: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)>'
# /tmp/d20131117-20795-1lhx3ms/spec.rb:12: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.01455 seconds
6 examples, 1 failure
Failed examples:
rspec /tmp/d20131117-20795-1lhx3ms/spec.rb:9 # Memoizer raises NoMethodError when an unknown method is called
-
Некоректно
- 5 успешни тест(а)
- 1 неуспешни тест(а)
Христо Хърсев
...F..
Failures:
1) Memoizer returns the actual class of the target object
Failure/Error: Memoizer.new(Object.new).class.should eq Object
expected: Object
got: Memoizer
(compared using ==)
Diff:
@@ -1,2 +1,2 @@
-Object
+Memoizer
# /tmp/d20131117-20795-1qv7cvq/spec.rb:32: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.01462 seconds
6 examples, 1 failure
Failed examples:
rspec /tmp/d20131117-20795-1qv7cvq/spec.rb:31 # Memoizer returns the actual class of the target object
-
Коректно
- 6 успешни тест(а)
- 0 неуспешни тест(а)
Илиян Бобев
......
Finished in 0.01105 seconds
6 examples, 0 failures
-
Некоректно
- 5 успешни тест(а)
- 1 неуспешни тест(а)
Наталия Пацовска
...F..
Failures:
1) Memoizer returns the actual class of the target object
Failure/Error: Memoizer.new(Object.new).class.should eq Object
expected: Object
got: Memoizer
(compared using ==)
Diff:
@@ -1,2 +1,2 @@
-Object
+Memoizer
# /tmp/d20131117-20795-pi0imb/spec.rb:32: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.016 seconds
6 examples, 1 failure
Failed examples:
rspec /tmp/d20131117-20795-pi0imb/spec.rb:31 # Memoizer returns the actual class of the target object
-
Некоректно
- 0 успешни тест(а)
- 0 неуспешни тест(а)
Димитър Димитров