Решение на Трета задача от Моника Димитрова
Обратно към всички решения
Към профила на Моника Димитрова
Резултати
- 4 точки от тестове
- 0 бонус точки
- 4 точки общо
- 51 успешни тест(а)
- 18 неуспешни тест(а)
Код
Лог от изпълнението
..F.....F.F..FFF..F................F.......FF.....F.......FFFFFF...F.
Failures:
1) Graphics Canvas can't be constructed with no arguments
Failure/Error: expect { Graphics::Canvas.new }.to raise_error(ArgumentError)
expected ArgumentError but nothing was raised
# /tmp/d20131223-4637-1x1ohx9/spec.rb:13: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) Graphics Canvas drawing of shapes and rasterization renders multiple drawn shapes
Failure/Error: ascii.should eq rendering(expected)
expected: "@@@@@@@@@@@@@@@\n@-------------@\n@-@@@@@@@@@@@-@\n@-@---------@-@\n@-@------@@-@-@\n@-@---@@@---@-@\n@-@-@@------@-@\n@-@---------@-@\n@-@-@@@@----@-@\n@-@-@-------@-@\n@-@---------@-@\n@-@---------@-@\n@-@@@@@@@@@@@-@\n@-------------@\n@@@@@@@@@@@@@@@"
got: "@@@@@@@@@@@@@@@\n@-------------@\n@-@@@@@@@@@@@-@\n@-@---------@-@\n@-@---------@-@\n@-@---------@-@\n@-@---------@-@\n@-@---------@-@\n@-@-@@@@----@-@\n@-@-@-------@-@\n@-@---------@-@\n@-@---------@-@\n@-@@@@@@@@@@@-@\n@-------------@\n@@@@@@@@@@@@@@@"
(compared using ==)
Diff:
@@ -2,9 +2,9 @@
@-------------@
@-@@@@@@@@@@@-@
@-@---------@-@
-@-@------@@-@-@
-@-@---@@@---@-@
-@-@-@@------@-@
+@-@---------@-@
+@-@---------@-@
+@-@---------@-@
@-@---------@-@
@-@-@@@@----@-@
@-@-@-------@-@
# /tmp/d20131223-4637-1x1ohx9/spec.rb:624:in `check_rendering_of'
# /tmp/d20131223-4637-1x1ohx9/spec.rb:211: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)>'
3) Graphics Canvas drawing of shapes and rasterization of points works for multiple ones
Failure/Error: canvas.set_pixel 4, 4
NoMethodError:
undefined method `[]=' for nil:NilClass
# /tmp/d20131223-4637-1x1ohx9/solution.rb:31:in `set_pixel'
# /tmp/d20131223-4637-1x1ohx9/spec.rb:57:in `block (5 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) Graphics Canvas drawing of shapes and rasterization of lines works with lines with a small slope
Failure/Error: ascii.should eq rendering(expected)
expected: "----------\n-@@-------\n---@@@@---\n-------@@-\n----------"
got: "----------\n----------\n----------\n----------\n----------"
(compared using ==)
Diff:
@@ -1,6 +1,6 @@
----------
--@@-------
----@@@@---
--------@@-
+----------
+----------
+----------
----------
# /tmp/d20131223-4637-1x1ohx9/spec.rb:624:in `check_rendering_of'
# /tmp/d20131223-4637-1x1ohx9/spec.rb:100:in `block (5 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) Graphics Canvas drawing of shapes and rasterization of lines works with lines with a significant slope, with swapped ends
Failure/Error: ascii.should eq rendering(expected)
expected: "----------\n-@--------\n-@--------\n--@-------\n--@-------\n--@-------\n--@-------\n---@------\n---@------\n----------"
got: "----------\n----------\n----------\n----------\n----------\n----------\n----------\n----------\n----------\n----------"
(compared using ==)
Diff:
@@ -1,11 +1,11 @@
----------
--@--------
--@--------
---@-------
---@-------
---@-------
---@-------
----@------
----@------
+----------
+----------
+----------
+----------
+----------
+----------
+----------
+----------
----------
# /tmp/d20131223-4637-1x1ohx9/spec.rb:624:in `check_rendering_of'
# /tmp/d20131223-4637-1x1ohx9/spec.rb:113:in `block (5 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) Graphics Canvas drawing of shapes and rasterization of lines works with multiple lines
Failure/Error: ascii.should eq rendering(expected)
expected: "-@--------\n-@@-------\n-@-@@@@---\n-@-----@@-\n----------"
got: "-@--------\n-@--------\n-@--------\n-@--------\n----------"
(compared using ==)
Diff:
@@ -1,6 +1,6 @@
-@--------
--@@-------
--@-@@@@---
--@-----@@-
+-@--------
+-@--------
+-@--------
----------
# /tmp/d20131223-4637-1x1ohx9/spec.rb:624:in `check_rendering_of'
# /tmp/d20131223-4637-1x1ohx9/spec.rb:132:in `block (5 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) Graphics Canvas drawing of shapes and rasterization of rectangles works with rects defined with their bottom left and top right points
Failure/Error: ascii.should eq rendering(expected)
expected: "----------\n-@@@@@@@@-\n-@------@-\n-@@@@@@@@-\n----------"
got: "----------\n-@@@@@@@@-\n--------@-\n--------@-\n----------"
(compared using ==)
Diff:
@@ -1,6 +1,6 @@
----------
-@@@@@@@@-
--@------@-
--@@@@@@@@-
+--------@-
+--------@-
----------
# /tmp/d20131223-4637-1x1ohx9/spec.rb:624:in `check_rendering_of'
# /tmp/d20131223-4637-1x1ohx9/spec.rb:171:in `block (5 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) Graphics shapes Point comparison for equality returns the same hash for the same points
Failure/Error: a1.hash.should eq a2.hash
expected: 575148069
got: 647949051
(compared using ==)
# /tmp/d20131223-4637-1x1ohx9/spec.rb:361:in `block (5 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) Graphics shapes Line initialization with swapped points puts the top point of vertical lines in the from field
Failure/Error: vertical_line.from.y.should eq 1
expected: 1
got: 8
(compared using ==)
# /tmp/d20131223-4637-1x1ohx9/spec.rb:413:in `block (6 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) Graphics shapes Line initialization with swapped points puts the bottom point of vertical lines in the to field
Failure/Error: vertical_line.to.y.should eq 8
expected: 8
got: 1
(compared using ==)
# /tmp/d20131223-4637-1x1ohx9/spec.rb:418:in `block (6 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) Graphics shapes Line comparison for equality returns the same hash if the lines are the same
Failure/Error: a.hash.should eq b.hash
expected: 692288727
got: 281282473
(compared using ==)
# /tmp/d20131223-4637-1x1ohx9/spec.rb:465:in `block (5 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) Graphics shapes Rectangle comparison for equality is true if rectangle points are the same
Failure/Error: (a == b).should be_true
expected: true value
got: false
# /tmp/d20131223-4637-1x1ohx9/spec.rb:526:in `block (5 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) Graphics shapes Rectangle comparison for equality is true if rectangle points are the same, even if swapped
Failure/Error: (a == b).should be_true
expected: true value
got: false
# /tmp/d20131223-4637-1x1ohx9/spec.rb:533:in `block (5 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) Graphics shapes Rectangle comparison for equality is true for rectangles defined with different diagonal corners
Failure/Error: (a == b).should be_true
expected: true value
got: false
# /tmp/d20131223-4637-1x1ohx9/spec.rb:540:in `block (5 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) Graphics shapes Rectangle comparison for equality works with eql? as well
Failure/Error: a.should eql b
expected: #<Graphics::Rectangle:0xb9704964 @left=#<Graphics::Point:0xb9704a18 @x=1, @y=1>, @right=#<Graphics::Point:0xb97049b4 @x=10, @y=14>>
got: #<Graphics::Rectangle:0xb9704a54 @left=#<Graphics::Point:0xb9704ab8 @x=1, @y=1>, @right=#<Graphics::Point:0xb9704a7c @x=10, @y=14>>
(compared using eql?)
Diff:
@@ -1,4 +1,4 @@
-#<Graphics::Rectangle:0xb9704964
- @left=#<Graphics::Point:0xb9704a18 @x=1, @y=1>,
- @right=#<Graphics::Point:0xb97049b4 @x=10, @y=14>>
+#<Graphics::Rectangle:0xb9704a54
+ @left=#<Graphics::Point:0xb9704ab8 @x=1, @y=1>,
+ @right=#<Graphics::Point:0xb9704a7c @x=10, @y=14>>
# /tmp/d20131223-4637-1x1ohx9/spec.rb:548:in `block (5 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) Graphics shapes Rectangle comparison for equality returns the same hash if the rectangles are the same
Failure/Error: a.hash.should eq b.hash
expected: 950252241
got: -421933557
(compared using ==)
# /tmp/d20131223-4637-1x1ohx9/spec.rb:556:in `block (5 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) Graphics shapes Rectangle comparison for equality returns the same hash for rectangles defined with different diagonal corners
Failure/Error: a.hash.should eq b.hash
expected: -367228569
got: 649800995
(compared using ==)
# /tmp/d20131223-4637-1x1ohx9/spec.rb:563:in `block (5 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) Graphics shapes Rectangle corners bottom right
Failure/Error: rect.bottom_right.y.should eq 4
expected: 4
got: 2
(compared using ==)
# /tmp/d20131223-4637-1x1ohx9/spec.rb:590:in `block (5 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.0936 seconds
69 examples, 18 failures
Failed examples:
rspec /tmp/d20131223-4637-1x1ohx9/spec.rb:12 # Graphics Canvas can't be constructed with no arguments
rspec /tmp/d20131223-4637-1x1ohx9/spec.rb:203 # Graphics Canvas drawing of shapes and rasterization renders multiple drawn shapes
rspec /tmp/d20131223-4637-1x1ohx9/spec.rb:51 # Graphics Canvas drawing of shapes and rasterization of points works for multiple ones
rspec /tmp/d20131223-4637-1x1ohx9/spec.rb:96 # Graphics Canvas drawing of shapes and rasterization of lines works with lines with a small slope
rspec /tmp/d20131223-4637-1x1ohx9/spec.rb:109 # Graphics Canvas drawing of shapes and rasterization of lines works with lines with a significant slope, with swapped ends
rspec /tmp/d20131223-4637-1x1ohx9/spec.rb:127 # Graphics Canvas drawing of shapes and rasterization of lines works with multiple lines
rspec /tmp/d20131223-4637-1x1ohx9/spec.rb:167 # Graphics Canvas drawing of shapes and rasterization of rectangles works with rects defined with their bottom left and top right points
rspec /tmp/d20131223-4637-1x1ohx9/spec.rb:360 # Graphics shapes Point comparison for equality returns the same hash for the same points
rspec /tmp/d20131223-4637-1x1ohx9/spec.rb:411 # Graphics shapes Line initialization with swapped points puts the top point of vertical lines in the from field
rspec /tmp/d20131223-4637-1x1ohx9/spec.rb:416 # Graphics shapes Line initialization with swapped points puts the bottom point of vertical lines in the to field
rspec /tmp/d20131223-4637-1x1ohx9/spec.rb:461 # Graphics shapes Line comparison for equality returns the same hash if the lines are the same
rspec /tmp/d20131223-4637-1x1ohx9/spec.rb:522 # Graphics shapes Rectangle comparison for equality is true if rectangle points are the same
rspec /tmp/d20131223-4637-1x1ohx9/spec.rb:529 # Graphics shapes Rectangle comparison for equality is true if rectangle points are the same, even if swapped
rspec /tmp/d20131223-4637-1x1ohx9/spec.rb:536 # Graphics shapes Rectangle comparison for equality is true for rectangles defined with different diagonal corners
rspec /tmp/d20131223-4637-1x1ohx9/spec.rb:543 # Graphics shapes Rectangle comparison for equality works with eql? as well
rspec /tmp/d20131223-4637-1x1ohx9/spec.rb:552 # Graphics shapes Rectangle comparison for equality returns the same hash if the rectangles are the same
rspec /tmp/d20131223-4637-1x1ohx9/spec.rb:559 # Graphics shapes Rectangle comparison for equality returns the same hash for rectangles defined with different diagonal corners
rspec /tmp/d20131223-4637-1x1ohx9/spec.rb:587 # Graphics shapes Rectangle corners bottom right
История (1 версия и 0 коментара)
Моника обнови решението на 22.12.2013 21:16 (преди почти 11 години)