Решение на Четвърта задача от Мартина Тонковска
Обратно към всички решения
Към профила на Мартина Тонковска
Резултати
- 3 точки от тестове
- 0 бонус точки
- 3 точки общо
- 32 успешни тест(а)
- 25 неуспешни тест(а)
Код
Лог от изпълнението
..F.F.FFFF..F....F.FFFF..F.FFF..............F.FFFF..F.FFF
Failures:
1) Card #== compares two cards by their rank and suit
Failure/Error: expect(Card.new(4, :spades)).to eq Card.new(4, :spades)
expected: #<Card:0x007f4b4ec8af50 @rank=4, @suit=:spades>
got: #<Card:0x007f4b4ec8b018 @rank=4, @suit=:spades>
(compared using ==)
Diff:
@@ -1,2 +1,2 @@
-#<Card:0x007f4b4ec8af50 @rank=4, @suit=:spades>
+#<Card:0x007f4b4ec8b018 @rank=4, @suit=:spades>
# /tmp/d20151112-27349-1fd5grw/spec.rb:131: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) WarDeck behaves like a deck fills the deck if no initialize parameters are given
Failure/Error: expect(deck.to_a).to match_array all_available_cards
expected collection contained: [#<Card:0x007f4b4fb3a870 @rank=2, @suit=:clubs>, #<Card:0x007f4b4fb3a848 @rank=3, @suit=:clubs>, #<Card:0x007f4b4fb3a820 @rank=4, @suit=:clubs>, #<Card:0x007f4b4fb3a7d0 @rank=5, @suit=:clubs>, #<Card:0x007f4b4fb3a7a8 @rank=6, @suit=:clubs>, #<Card:0x007f4b4fb3a758 @rank=7, @suit=:clubs>, #<Card:0x007f4b4fb3a730 @rank=8, @suit=:clubs>, #<Card:0x007f4b4fb3a708 @rank=9, @suit=:clubs>, #<Card:0x007f4b4fb3a6b8 @rank=10, @suit=:clubs>, #<Card:0x007f4b4fb3a690 @rank=:jack, @suit=:clubs>, #<Card:0x007f4b4fb3a668 @rank=:queen, @suit=:clubs>, #<Card:0x007f4b4fb3a640 @rank=:king, @suit=:clubs>, #<Card:0x007f4b4fb3a618 @rank=:ace, @suit=:clubs>, #<Card:0x007f4b4fb3a5c8 @rank=2, @suit=:diamonds>, #<Card:0x007f4b4fb3a550 @rank=3, @suit=:diamonds>, #<Card:0x007f4b4fb3a528 @rank=4, @suit=:diamonds>, #<Card:0x007f4b4fb3a500 @rank=5, @suit=:diamonds>, #<Card:0x007f4b4fb3a4d8 @rank=6, @suit=:diamonds>, #<Card:0x007f4b4fb3a4b0 @rank=7, @suit=:diamonds>, #<Card:0x007f4b4fb3a488 @rank=8, @suit=:diamonds>, #<Card:0x007f4b4fb3a460 @rank=9, @suit=:diamonds>, #<Card:0x007f4b4fb3a438 @rank=10, @suit=:diamonds>, #<Card:0x007f4b4fb3a3e8 @rank=:jack, @suit=:diamonds>, #<Card:0x007f4b4fb3a3c0 @rank=:queen, @suit=:diamonds>, #<Card:0x007f4b4fb3a370 @rank=:king, @suit=:diamonds>, #<Card:0x007f4b4fb3a348 @rank=:ace, @suit=:diamonds>, #<Card:0x007f4b4fb3a320 @rank=2, @suit=:hearts>, #<Card:0x007f4b4fb3a2d0 @rank=3, @suit=:hearts>, #<Card:0x007f4b4fb3a280 @rank=4, @suit=:hearts>, #<Card:0x007f4b4fb3a258 @rank=5, @suit=:hearts>, #<Card:0x007f4b4fb3a230 @rank=6, @suit=:hearts>, #<Card:0x007f4b4fb3a208 @rank=7, @suit=:hearts>, #<Card:0x007f4b4fb3a1e0 @rank=8, @suit=:hearts>, #<Card:0x007f4b4fb3a190 @rank=9, @suit=:hearts>, #<Card:0x007f4b4fb3a118 @rank=10, @suit=:hearts>, #<Card:0x007f4b4fb3a0f0 @rank=:jack, @suit=:hearts>, #<Card:0x007f4b4fb3a0c8 @rank=:queen, @suit=:hearts>, #<Card:0x007f4b4fb3a0a0 @rank=:king, @suit=:hearts>, #<Card:0x007f4b4fb3a078 @rank=:ace, @suit=:hearts>, #<Card:0x007f4b4fb3a050 @rank=2, @suit=:spades>, #<Card:0x007f4b4fb3a028 @rank=3, @suit=:spades>, #<Card:0x007f4b4fb3a000 @rank=4, @suit=:spades>, #<Card:0x007f4b4fb39fb0 @rank=5, @suit=:spades>, #<Card:0x007f4b4fb39f88 @rank=6, @suit=:spades>, #<Card:0x007f4b4fb39f38 @rank=7, @suit=:spades>, #<Card:0x007f4b4fb39f10 @rank=8, @suit=:spades>, #<Card:0x007f4b4fb39ee8 @rank=9, @suit=:spades>, #<Card:0x007f4b4fb39e98 @rank=10, @suit=:spades>, #<Card:0x007f4b4fb39e70 @rank=:jack, @suit=:spades>, #<Card:0x007f4b4fb39e48 @rank=:queen, @suit=:spades>, #<Card:0x007f4b4fb39e20 @rank=:king, @suit=:spades>, #<Card:0x007f4b4fb39df8 @rank=:ace, @suit=:spades>]
actual collection contained: [#<Card:0x007f4b4fa5ccf0 @rank=2, @suit=:spades>, #<Card:0x007f4b4fa5ccc8 @rank=2, @suit=:hearts>, #<Card:0x007f4b4fa5cca0 @rank=2, @suit=:diamonds>, #<Card:0x007f4b4fa5cc78 @rank=2, @suit=:clubs>, #<Card:0x007f4b4fa5cc50 @rank=3, @suit=:spades>, #<Card:0x007f4b4fa5cc28 @rank=3, @suit=:hearts>, #<Card:0x007f4b4fa5cbd8 @rank=3, @suit=:diamonds>, #<Card:0x007f4b4fa5cbb0 @rank=3, @suit=:clubs>, #<Card:0x007f4b4fa5cb88 @rank=4, @suit=:spades>, #<Card:0x007f4b4fa5cb60 @rank=4, @suit=:hearts>, #<Card:0x007f4b4fa5cb38 @rank=4, @suit=:diamonds>, #<Card:0x007f4b4fa5cb10 @rank=4, @suit=:clubs>, #<Card:0x007f4b4fa5cac0 @rank=5, @suit=:spades>, #<Card:0x007f4b4fa5ca98 @rank=5, @suit=:hearts>, #<Card:0x007f4b4fa5ca70 @rank=5, @suit=:diamonds>, #<Card:0x007f4b4fa5ca48 @rank=5, @suit=:clubs>, #<Card:0x007f4b4fa5ca20 @rank=6, @suit=:spades>, #<Card:0x007f4b4fa5c9d0 @rank=6, @suit=:hearts>, #<Card:0x007f4b4fa5c980 @rank=6, @suit=:diamonds>, #<Card:0x007f4b4fa5c958 @rank=6, @suit=:clubs>, #<Card:0x007f4b4fa5c908 @rank=7, @suit=:spades>, #<Card:0x007f4b4fa5c8e0 @rank=7, @suit=:hearts>, #<Card:0x007f4b4fa5c8b8 @rank=7, @suit=:diamonds>, #<Card:0x007f4b4fa5c868 @rank=7, @suit=:clubs>, #<Card:0x007f4b4fa5c840 @rank=8, @suit=:spades>, #<Card:0x007f4b4fa5c818 @rank=8, @suit=:hearts>, #<Card:0x007f4b4fa5c7f0 @rank=8, @suit=:diamonds>, #<Card:0x007f4b4fa5c7c8 @rank=8, @suit=:clubs>, #<Card:0x007f4b4fa5c7a0 @rank=9, @suit=:spades>, #<Card:0x007f4b4fa5c750 @rank=9, @suit=:hearts>, #<Card:0x007f4b4fa5c728 @rank=9, @suit=:diamonds>, #<Card:0x007f4b4fa5c700 @rank=9, @suit=:clubs>, #<Card:0x007f4b4fa5c6d8 @rank=10, @suit=:spades>, #<Card:0x007f4b4fa5c6b0 @rank=10, @suit=:hearts>, #<Card:0x007f4b4fa5c688 @rank=10, @suit=:diamonds>, #<Card:0x007f4b4fa5c638 @rank=10, @suit=:clubs>, #<Card:0x007f4b4fa5c5e8 @rank=:jack, @suit=:spades>, #<Card:0x007f4b4fa5c5c0 @rank=:jack, @suit=:hearts>, #<Card:0x007f4b4fa5c598 @rank=:jack, @suit=:diamonds>, #<Card:0x007f4b4fa5c570 @rank=:jack, @suit=:clubs>, #<Card:0x007f4b4fa5c548 @rank=:queen, @suit=:spades>, #<Card:0x007f4b4fa5c520 @rank=:queen, @suit=:hearts>, #<Card:0x007f4b4fa5c4d0 @rank=:queen, @suit=:diamonds>, #<Card:0x007f4b4fa5c4a8 @rank=:queen, @suit=:clubs>, #<Card:0x007f4b4fa5c480 @rank=:king, @suit=:spades>, #<Card:0x007f4b4fa5c458 @rank=:king, @suit=:hearts>, #<Card:0x007f4b4fa5c430 @rank=:king, @suit=:diamonds>, #<Card:0x007f4b4fa5c408 @rank=:king, @suit=:clubs>, #<Card:0x007f4b4fa5c3b8 @rank=:ace, @suit=:spades>, #<Card:0x007f4b4fa5c390 @rank=:ace, @suit=:hearts>, #<Card:0x007f4b4fa5c368 @rank=:ace, @suit=:diamonds>, #<Card:0x007f4b4fa5c340 @rank=:ace, @suit=:clubs>]
the missing elements were: [#<Card:0x007f4b4fb3a870 @rank=2, @suit=:clubs>, #<Card:0x007f4b4fb3a848 @rank=3, @suit=:clubs>, #<Card:0x007f4b4fb3a820 @rank=4, @suit=:clubs>, #<Card:0x007f4b4fb3a7d0 @rank=5, @suit=:clubs>, #<Card:0x007f4b4fb3a7a8 @rank=6, @suit=:clubs>, #<Card:0x007f4b4fb3a758 @rank=7, @suit=:clubs>, #<Card:0x007f4b4fb3a730 @rank=8, @suit=:clubs>, #<Card:0x007f4b4fb3a708 @rank=9, @suit=:clubs>, #<Card:0x007f4b4fb3a6b8 @rank=10, @suit=:clubs>, #<Card:0x007f4b4fb3a690 @rank=:jack, @suit=:clubs>, #<Card:0x007f4b4fb3a668 @rank=:queen, @suit=:clubs>, #<Card:0x007f4b4fb3a640 @rank=:king, @suit=:clubs>, #<Card:0x007f4b4fb3a618 @rank=:ace, @suit=:clubs>, #<Card:0x007f4b4fb3a5c8 @rank=2, @suit=:diamonds>, #<Card:0x007f4b4fb3a550 @rank=3, @suit=:diamonds>, #<Card:0x007f4b4fb3a528 @rank=4, @suit=:diamonds>, #<Card:0x007f4b4fb3a500 @rank=5, @suit=:diamonds>, #<Card:0x007f4b4fb3a4d8 @rank=6, @suit=:diamonds>, #<Card:0x007f4b4fb3a4b0 @rank=7, @suit=:diamonds>, #<Card:0x007f4b4fb3a488 @rank=8, @suit=:diamonds>, #<Card:0x007f4b4fb3a460 @rank=9, @suit=:diamonds>, #<Card:0x007f4b4fb3a438 @rank=10, @suit=:diamonds>, #<Card:0x007f4b4fb3a3e8 @rank=:jack, @suit=:diamonds>, #<Card:0x007f4b4fb3a3c0 @rank=:queen, @suit=:diamonds>, #<Card:0x007f4b4fb3a370 @rank=:king, @suit=:diamonds>, #<Card:0x007f4b4fb3a348 @rank=:ace, @suit=:diamonds>, #<Card:0x007f4b4fb3a320 @rank=2, @suit=:hearts>, #<Card:0x007f4b4fb3a2d0 @rank=3, @suit=:hearts>, #<Card:0x007f4b4fb3a280 @rank=4, @suit=:hearts>, #<Card:0x007f4b4fb3a258 @rank=5, @suit=:hearts>, #<Card:0x007f4b4fb3a230 @rank=6, @suit=:hearts>, #<Card:0x007f4b4fb3a208 @rank=7, @suit=:hearts>, #<Card:0x007f4b4fb3a1e0 @rank=8, @suit=:hearts>, #<Card:0x007f4b4fb3a190 @rank=9, @suit=:hearts>, #<Card:0x007f4b4fb3a118 @rank=10, @suit=:hearts>, #<Card:0x007f4b4fb3a0f0 @rank=:jack, @suit=:hearts>, #<Card:0x007f4b4fb3a0c8 @rank=:queen, @suit=:hearts>, #<Card:0x007f4b4fb3a0a0 @rank=:king, @suit=:hearts>, #<Card:0x007f4b4fb3a078 @rank=:ace, @suit=:hearts>, #<Card:0x007f4b4fb3a050 @rank=2, @suit=:spades>, #<Card:0x007f4b4fb3a028 @rank=3, @suit=:spades>, #<Card:0x007f4b4fb3a000 @rank=4, @suit=:spades>, #<Card:0x007f4b4fb39fb0 @rank=5, @suit=:spades>, #<Card:0x007f4b4fb39f88 @rank=6, @suit=:spades>, #<Card:0x007f4b4fb39f38 @rank=7, @suit=:spades>, #<Card:0x007f4b4fb39f10 @rank=8, @suit=:spades>, #<Card:0x007f4b4fb39ee8 @rank=9, @suit=:spades>, #<Card:0x007f4b4fb39e98 @rank=10, @suit=:spades>, #<Card:0x007f4b4fb39e70 @rank=:jack, @suit=:spades>, #<Card:0x007f4b4fb39e48 @rank=:queen, @suit=:spades>, #<Card:0x007f4b4fb39e20 @rank=:king, @suit=:spades>, #<Card:0x007f4b4fb39df8 @rank=:ace, @suit=:spades>]
the extra elements were: [#<Card:0x007f4b4fa5ccf0 @rank=2, @suit=:spades>, #<Card:0x007f4b4fa5ccc8 @rank=2, @suit=:hearts>, #<Card:0x007f4b4fa5cca0 @rank=2, @suit=:diamonds>, #<Card:0x007f4b4fa5cc78 @rank=2, @suit=:clubs>, #<Card:0x007f4b4fa5cc50 @rank=3, @suit=:spades>, #<Card:0x007f4b4fa5cc28 @rank=3, @suit=:hearts>, #<Card:0x007f4b4fa5cbd8 @rank=3, @suit=:diamonds>, #<Card:0x007f4b4fa5cbb0 @rank=3, @suit=:clubs>, #<Card:0x007f4b4fa5cb88 @rank=4, @suit=:spades>, #<Card:0x007f4b4fa5cb60 @rank=4, @suit=:hearts>, #<Card:0x007f4b4fa5cb38 @rank=4, @suit=:diamonds>, #<Card:0x007f4b4fa5cb10 @rank=4, @suit=:clubs>, #<Card:0x007f4b4fa5cac0 @rank=5, @suit=:spades>, #<Card:0x007f4b4fa5ca98 @rank=5, @suit=:hearts>, #<Card:0x007f4b4fa5ca70 @rank=5, @suit=:diamonds>, #<Card:0x007f4b4fa5ca48 @rank=5, @suit=:clubs>, #<Card:0x007f4b4fa5ca20 @rank=6, @suit=:spades>, #<Card:0x007f4b4fa5c9d0 @rank=6, @suit=:hearts>, #<Card:0x007f4b4fa5c980 @rank=6, @suit=:diamonds>, #<Card:0x007f4b4fa5c958 @rank=6, @suit=:clubs>, #<Card:0x007f4b4fa5c908 @rank=7, @suit=:spades>, #<Card:0x007f4b4fa5c8e0 @rank=7, @suit=:hearts>, #<Card:0x007f4b4fa5c8b8 @rank=7, @suit=:diamonds>, #<Card:0x007f4b4fa5c868 @rank=7, @suit=:clubs>, #<Card:0x007f4b4fa5c840 @rank=8, @suit=:spades>, #<Card:0x007f4b4fa5c818 @rank=8, @suit=:hearts>, #<Card:0x007f4b4fa5c7f0 @rank=8, @suit=:diamonds>, #<Card:0x007f4b4fa5c7c8 @rank=8, @suit=:clubs>, #<Card:0x007f4b4fa5c7a0 @rank=9, @suit=:spades>, #<Card:0x007f4b4fa5c750 @rank=9, @suit=:hearts>, #<Card:0x007f4b4fa5c728 @rank=9, @suit=:diamonds>, #<Card:0x007f4b4fa5c700 @rank=9, @suit=:clubs>, #<Card:0x007f4b4fa5c6d8 @rank=10, @suit=:spades>, #<Card:0x007f4b4fa5c6b0 @rank=10, @suit=:hearts>, #<Card:0x007f4b4fa5c688 @rank=10, @suit=:diamonds>, #<Card:0x007f4b4fa5c638 @rank=10, @suit=:clubs>, #<Card:0x007f4b4fa5c5e8 @rank=:jack, @suit=:spades>, #<Card:0x007f4b4fa5c5c0 @rank=:jack, @suit=:hearts>, #<Card:0x007f4b4fa5c598 @rank=:jack, @suit=:diamonds>, #<Card:0x007f4b4fa5c570 @rank=:jack, @suit=:clubs>, #<Card:0x007f4b4fa5c548 @rank=:queen, @suit=:spades>, #<Card:0x007f4b4fa5c520 @rank=:queen, @suit=:hearts>, #<Card:0x007f4b4fa5c4d0 @rank=:queen, @suit=:diamonds>, #<Card:0x007f4b4fa5c4a8 @rank=:queen, @suit=:clubs>, #<Card:0x007f4b4fa5c480 @rank=:king, @suit=:spades>, #<Card:0x007f4b4fa5c458 @rank=:king, @suit=:hearts>, #<Card:0x007f4b4fa5c430 @rank=:king, @suit=:diamonds>, #<Card:0x007f4b4fa5c408 @rank=:king, @suit=:clubs>, #<Card:0x007f4b4fa5c3b8 @rank=:ace, @suit=:spades>, #<Card:0x007f4b4fa5c390 @rank=:ace, @suit=:hearts>, #<Card:0x007f4b4fa5c368 @rank=:ace, @suit=:diamonds>, #<Card:0x007f4b4fa5c340 @rank=:ace, @suit=:clubs>]
Shared Example Group: "a deck" called from /tmp/d20151112-27349-1fd5grw/spec.rb:140
# /tmp/d20151112-27349-1fd5grw/spec.rb:18: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) WarDeck behaves like a deck #draw_top_card pops the top-most card
Failure/Error: expect(small_deck.draw_top_card).to eq ace_of_spades
expected: #<Card:0x007f4b4fa0c688 @rank=:ace, @suit=:spades>
got: #<Card:0x007f4b4fa0c660 @rank=9, @suit=:clubs>
(compared using ==)
Diff:
@@ -1,2 +1,2 @@
-#<Card:0x007f4b4fa0c688 @rank=:ace, @suit=:spades>
+#<Card:0x007f4b4fa0c660 @rank=9, @suit=:clubs>
Shared Example Group: "a deck" called from /tmp/d20151112-27349-1fd5grw/spec.rb:140
# /tmp/d20151112-27349-1fd5grw/spec.rb:29: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) WarDeck behaves like a deck #draw_bottom_card pops the bottom-most card
Failure/Error: expect(small_deck.draw_bottom_card).to eq nine_of_clubs
expected: #<Card:0x007f4b4fb2e098 @rank=9, @suit=:clubs>
got: #<Card:0x007f4b4fb2e0c0 @rank=:ace, @suit=:spades>
(compared using ==)
Diff:
@@ -1,2 +1,2 @@
-#<Card:0x007f4b4fb2e098 @rank=9, @suit=:clubs>
+#<Card:0x007f4b4fb2e0c0 @rank=:ace, @suit=:spades>
Shared Example Group: "a deck" called from /tmp/d20151112-27349-1fd5grw/spec.rb:140
# /tmp/d20151112-27349-1fd5grw/spec.rb:36: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) WarDeck behaves like a deck #top peeks at the top-most card
Failure/Error: expect(small_deck.top_card).to eq ace_of_spades
expected: #<Card:0x007f4b4fb17a00 @rank=:ace, @suit=:spades>
got: #<Card:0x007f4b4fb179b0 @rank=9, @suit=:clubs>
(compared using ==)
Diff:
@@ -1,2 +1,2 @@
-#<Card:0x007f4b4fb17a00 @rank=:ace, @suit=:spades>
+#<Card:0x007f4b4fb179b0 @rank=9, @suit=:clubs>
Shared Example Group: "a deck" called from /tmp/d20151112-27349-1fd5grw/spec.rb:140
# /tmp/d20151112-27349-1fd5grw/spec.rb:43: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) WarDeck behaves like a deck #bottom peeks at the bottom-most card
Failure/Error: expect(small_deck.bottom_card).to eq nine_of_clubs
expected: #<Card:0x007f4b4fad8d28 @rank=9, @suit=:clubs>
got: #<Card:0x007f4b4fad8d50 @rank=:ace, @suit=:spades>
(compared using ==)
Diff:
@@ -1,2 +1,2 @@
-#<Card:0x007f4b4fad8d28 @rank=9, @suit=:clubs>
+#<Card:0x007f4b4fad8d50 @rank=:ace, @suit=:spades>
Shared Example Group: "a deck" called from /tmp/d20151112-27349-1fd5grw/spec.rb:140
# /tmp/d20151112-27349-1fd5grw/spec.rb:50: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) WarDeck #sort sorts the cards in the defined order
Failure/Error: expect(deck.sort.to_a).to eq [jack_of_spades, ten_of_hearts, ace_of_clubs, two_of_clubs]
expected: [#<Card:0x007f4b4faae1b8 @rank=:jack, @suit=:spades>, #<Card:0x007f4b4faae118 @rank=10, @suit=:hearts>, #<Card:0x007f4b4faae258 @rank=:ace, @suit=:clubs>, #<Card:0x007f4b4faae168 @rank=2, @suit=:clubs>]
got: [#<Card:0x007f4b4faae258 @rank=:ace, @suit=:clubs>, #<Card:0x007f4b4faae168 @rank=2, @suit=:clubs>, #<Card:0x007f4b4faae118 @rank=10, @suit=:hearts>, #<Card:0x007f4b4faae1b8 @rank=:jack, @suit=:spades>]
(compared using ==)
Diff:
@@ -1,5 +1,5 @@
-[#<Card:0x007f4b4faae1b8 @rank=:jack, @suit=:spades>,
+[#<Card:0x007f4b4faae258 @rank=:ace, @suit=:clubs>,
+ #<Card:0x007f4b4faae168 @rank=2, @suit=:clubs>,
#<Card:0x007f4b4faae118 @rank=10, @suit=:hearts>,
- #<Card:0x007f4b4faae258 @rank=:ace, @suit=:clubs>,
- #<Card:0x007f4b4faae168 @rank=2, @suit=:clubs>]
+ #<Card:0x007f4b4faae1b8 @rank=:jack, @suit=:spades>]
# /tmp/d20151112-27349-1fd5grw/spec.rb:155: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) BeloteDeck behaves like a deck fills the deck if no initialize parameters are given
Failure/Error: expect(deck.to_a).to match_array all_available_cards
expected collection contained: [#<Card:0x007f4b4f9c6098 @rank=7, @suit=:clubs>, #<Card:0x007f4b4f9c6070 @rank=8, @suit=:clubs>, #<Card:0x007f4b4f9c6048 @rank=9, @suit=:clubs>, #<Card:0x007f4b4f9c6020 @rank=:jack, @suit=:clubs>, #<Card:0x007f4b4f9c5ff8 @rank=:queen, @suit=:clubs>, #<Card:0x007f4b4f9c5f30 @rank=:king, @suit=:clubs>, #<Card:0x007f4b4f9c5f08 @rank=10, @suit=:clubs>, #<Card:0x007f4b4f9c5eb8 @rank=:ace, @suit=:clubs>, #<Card:0x007f4b4f9c5e90 @rank=7, @suit=:diamonds>, #<Card:0x007f4b4f9c5da0 @rank=8, @suit=:diamonds>, #<Card:0x007f4b4f9c5d78 @rank=9, @suit=:diamonds>, #<Card:0x007f4b4f9c5cd8 @rank=:jack, @suit=:diamonds>, #<Card:0x007f4b4f9c5cb0 @rank=:queen, @suit=:diamonds>, #<Card:0x007f4b4f9c5c88 @rank=:king, @suit=:diamonds>, #<Card:0x007f4b4f9c5c10 @rank=10, @suit=:diamonds>, #<Card:0x007f4b4f9c5be8 @rank=:ace, @suit=:diamonds>, #<Card:0x007f4b4f9c5bc0 @rank=7, @suit=:hearts>, #<Card:0x007f4b4f9c5b98 @rank=8, @suit=:hearts>, #<Card:0x007f4b4f9c5b20 @rank=9, @suit=:hearts>, #<Card:0x007f4b4f9c5aa8 @rank=:jack, @suit=:hearts>, #<Card:0x007f4b4f9c59e0 @rank=:queen, @suit=:hearts>, #<Card:0x007f4b4f9c59b8 @rank=:king, @suit=:hearts>, #<Card:0x007f4b4f9c5968 @rank=10, @suit=:hearts>, #<Card:0x007f4b4f9c5940 @rank=:ace, @suit=:hearts>, #<Card:0x007f4b4f9c58a0 @rank=7, @suit=:spades>, #<Card:0x007f4b4f9c5760 @rank=8, @suit=:spades>, #<Card:0x007f4b4f9c5738 @rank=9, @suit=:spades>, #<Card:0x007f4b4f9c5710 @rank=:jack, @suit=:spades>, #<Card:0x007f4b4f9c5670 @rank=:queen, @suit=:spades>, #<Card:0x007f4b4f9c5648 @rank=:king, @suit=:spades>, #<Card:0x007f4b4f9c55f8 @rank=10, @suit=:spades>, #<Card:0x007f4b4f9c5530 @rank=:ace, @suit=:spades>]
actual collection contained: [#<Card:0x007f4b4f9c6ed0 @rank=7, @suit=:spades>, #<Card:0x007f4b4f9c6ea8 @rank=7, @suit=:hearts>, #<Card:0x007f4b4f9c6e80 @rank=7, @suit=:diamonds>, #<Card:0x007f4b4f9c6e58 @rank=7, @suit=:clubs>, #<Card:0x007f4b4f9c6e30 @rank=8, @suit=:spades>, #<Card:0x007f4b4f9c6e08 @rank=8, @suit=:hearts>, #<Card:0x007f4b4f9c6db8 @rank=8, @suit=:diamonds>, #<Card:0x007f4b4f9c6d90 @rank=8, @suit=:clubs>, #<Card:0x007f4b4f9c6d68 @rank=9, @suit=:spades>, #<Card:0x007f4b4f9c6d40 @rank=9, @suit=:hearts>, #<Card:0x007f4b4f9c6d18 @rank=9, @suit=:diamonds>, #<Card:0x007f4b4f9c6cf0 @rank=9, @suit=:clubs>, #<Card:0x007f4b4f9c6cc8 @rank=:jack, @suit=:spades>, #<Card:0x007f4b4f9c6ca0 @rank=:jack, @suit=:hearts>, #<Card:0x007f4b4f9c6c78 @rank=:jack, @suit=:diamonds>, #<Card:0x007f4b4f9c6c50 @rank=:jack, @suit=:clubs>, #<Card:0x007f4b4f9c6c28 @rank=:queen, @suit=:spades>, #<Card:0x007f4b4f9c6bd8 @rank=:queen, @suit=:hearts>, #<Card:0x007f4b4f9c6bb0 @rank=:queen, @suit=:diamonds>, #<Card:0x007f4b4f9c6b60 @rank=:queen, @suit=:clubs>, #<Card:0x007f4b4f9c6b38 @rank=:king, @suit=:spades>, #<Card:0x007f4b4f9c6a70 @rank=:king, @suit=:hearts>, #<Card:0x007f4b4f9c6a48 @rank=:king, @suit=:diamonds>, #<Card:0x007f4b4f9c6a20 @rank=:king, @suit=:clubs>, #<Card:0x007f4b4f9c69a8 @rank=10, @suit=:spades>, #<Card:0x007f4b4f9c6980 @rank=10, @suit=:hearts>, #<Card:0x007f4b4f9c6958 @rank=10, @suit=:diamonds>, #<Card:0x007f4b4f9c6908 @rank=10, @suit=:clubs>, #<Card:0x007f4b4f9c68e0 @rank=:ace, @suit=:spades>, #<Card:0x007f4b4f9c68b8 @rank=:ace, @suit=:hearts>, #<Card:0x007f4b4f9c6890 @rank=:ace, @suit=:diamonds>, #<Card:0x007f4b4f9c6868 @rank=:ace, @suit=:clubs>]
the missing elements were: [#<Card:0x007f4b4f9c6098 @rank=7, @suit=:clubs>, #<Card:0x007f4b4f9c6070 @rank=8, @suit=:clubs>, #<Card:0x007f4b4f9c6048 @rank=9, @suit=:clubs>, #<Card:0x007f4b4f9c6020 @rank=:jack, @suit=:clubs>, #<Card:0x007f4b4f9c5ff8 @rank=:queen, @suit=:clubs>, #<Card:0x007f4b4f9c5f30 @rank=:king, @suit=:clubs>, #<Card:0x007f4b4f9c5f08 @rank=10, @suit=:clubs>, #<Card:0x007f4b4f9c5eb8 @rank=:ace, @suit=:clubs>, #<Card:0x007f4b4f9c5e90 @rank=7, @suit=:diamonds>, #<Card:0x007f4b4f9c5da0 @rank=8, @suit=:diamonds>, #<Card:0x007f4b4f9c5d78 @rank=9, @suit=:diamonds>, #<Card:0x007f4b4f9c5cd8 @rank=:jack, @suit=:diamonds>, #<Card:0x007f4b4f9c5cb0 @rank=:queen, @suit=:diamonds>, #<Card:0x007f4b4f9c5c88 @rank=:king, @suit=:diamonds>, #<Card:0x007f4b4f9c5c10 @rank=10, @suit=:diamonds>, #<Card:0x007f4b4f9c5be8 @rank=:ace, @suit=:diamonds>, #<Card:0x007f4b4f9c5bc0 @rank=7, @suit=:hearts>, #<Card:0x007f4b4f9c5b98 @rank=8, @suit=:hearts>, #<Card:0x007f4b4f9c5b20 @rank=9, @suit=:hearts>, #<Card:0x007f4b4f9c5aa8 @rank=:jack, @suit=:hearts>, #<Card:0x007f4b4f9c59e0 @rank=:queen, @suit=:hearts>, #<Card:0x007f4b4f9c59b8 @rank=:king, @suit=:hearts>, #<Card:0x007f4b4f9c5968 @rank=10, @suit=:hearts>, #<Card:0x007f4b4f9c5940 @rank=:ace, @suit=:hearts>, #<Card:0x007f4b4f9c58a0 @rank=7, @suit=:spades>, #<Card:0x007f4b4f9c5760 @rank=8, @suit=:spades>, #<Card:0x007f4b4f9c5738 @rank=9, @suit=:spades>, #<Card:0x007f4b4f9c5710 @rank=:jack, @suit=:spades>, #<Card:0x007f4b4f9c5670 @rank=:queen, @suit=:spades>, #<Card:0x007f4b4f9c5648 @rank=:king, @suit=:spades>, #<Card:0x007f4b4f9c55f8 @rank=10, @suit=:spades>, #<Card:0x007f4b4f9c5530 @rank=:ace, @suit=:spades>]
the extra elements were: [#<Card:0x007f4b4f9c6ed0 @rank=7, @suit=:spades>, #<Card:0x007f4b4f9c6ea8 @rank=7, @suit=:hearts>, #<Card:0x007f4b4f9c6e80 @rank=7, @suit=:diamonds>, #<Card:0x007f4b4f9c6e58 @rank=7, @suit=:clubs>, #<Card:0x007f4b4f9c6e30 @rank=8, @suit=:spades>, #<Card:0x007f4b4f9c6e08 @rank=8, @suit=:hearts>, #<Card:0x007f4b4f9c6db8 @rank=8, @suit=:diamonds>, #<Card:0x007f4b4f9c6d90 @rank=8, @suit=:clubs>, #<Card:0x007f4b4f9c6d68 @rank=9, @suit=:spades>, #<Card:0x007f4b4f9c6d40 @rank=9, @suit=:hearts>, #<Card:0x007f4b4f9c6d18 @rank=9, @suit=:diamonds>, #<Card:0x007f4b4f9c6cf0 @rank=9, @suit=:clubs>, #<Card:0x007f4b4f9c6cc8 @rank=:jack, @suit=:spades>, #<Card:0x007f4b4f9c6ca0 @rank=:jack, @suit=:hearts>, #<Card:0x007f4b4f9c6c78 @rank=:jack, @suit=:diamonds>, #<Card:0x007f4b4f9c6c50 @rank=:jack, @suit=:clubs>, #<Card:0x007f4b4f9c6c28 @rank=:queen, @suit=:spades>, #<Card:0x007f4b4f9c6bd8 @rank=:queen, @suit=:hearts>, #<Card:0x007f4b4f9c6bb0 @rank=:queen, @suit=:diamonds>, #<Card:0x007f4b4f9c6b60 @rank=:queen, @suit=:clubs>, #<Card:0x007f4b4f9c6b38 @rank=:king, @suit=:spades>, #<Card:0x007f4b4f9c6a70 @rank=:king, @suit=:hearts>, #<Card:0x007f4b4f9c6a48 @rank=:king, @suit=:diamonds>, #<Card:0x007f4b4f9c6a20 @rank=:king, @suit=:clubs>, #<Card:0x007f4b4f9c69a8 @rank=10, @suit=:spades>, #<Card:0x007f4b4f9c6980 @rank=10, @suit=:hearts>, #<Card:0x007f4b4f9c6958 @rank=10, @suit=:diamonds>, #<Card:0x007f4b4f9c6908 @rank=10, @suit=:clubs>, #<Card:0x007f4b4f9c68e0 @rank=:ace, @suit=:spades>, #<Card:0x007f4b4f9c68b8 @rank=:ace, @suit=:hearts>, #<Card:0x007f4b4f9c6890 @rank=:ace, @suit=:diamonds>, #<Card:0x007f4b4f9c6868 @rank=:ace, @suit=:clubs>]
Shared Example Group: "a deck" called from /tmp/d20151112-27349-1fd5grw/spec.rb:191
# /tmp/d20151112-27349-1fd5grw/spec.rb:18: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)>'
9) BeloteDeck behaves like a deck #draw_top_card pops the top-most card
Failure/Error: expect(small_deck.draw_top_card).to eq ace_of_spades
expected: #<Card:0x007f4b4f981ec0 @rank=:ace, @suit=:spades>
got: #<Card:0x007f4b4f981e98 @rank=9, @suit=:clubs>
(compared using ==)
Diff:
@@ -1,2 +1,2 @@
-#<Card:0x007f4b4f981ec0 @rank=:ace, @suit=:spades>
+#<Card:0x007f4b4f981e98 @rank=9, @suit=:clubs>
Shared Example Group: "a deck" called from /tmp/d20151112-27349-1fd5grw/spec.rb:191
# /tmp/d20151112-27349-1fd5grw/spec.rb:29: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) BeloteDeck behaves like a deck #draw_bottom_card pops the bottom-most card
Failure/Error: expect(small_deck.draw_bottom_card).to eq nine_of_clubs
expected: #<Card:0x007f4b4f9561f8 @rank=9, @suit=:clubs>
got: #<Card:0x007f4b4f956248 @rank=:ace, @suit=:spades>
(compared using ==)
Diff:
@@ -1,2 +1,2 @@
-#<Card:0x007f4b4f9561f8 @rank=9, @suit=:clubs>
+#<Card:0x007f4b4f956248 @rank=:ace, @suit=:spades>
Shared Example Group: "a deck" called from /tmp/d20151112-27349-1fd5grw/spec.rb:191
# /tmp/d20151112-27349-1fd5grw/spec.rb:36: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) BeloteDeck behaves like a deck #top peeks at the top-most card
Failure/Error: expect(small_deck.top_card).to eq ace_of_spades
expected: #<Card:0x007f4b4f92b2c8 @rank=:ace, @suit=:spades>
got: #<Card:0x007f4b4f92b2a0 @rank=9, @suit=:clubs>
(compared using ==)
Diff:
@@ -1,2 +1,2 @@
-#<Card:0x007f4b4f92b2c8 @rank=:ace, @suit=:spades>
+#<Card:0x007f4b4f92b2a0 @rank=9, @suit=:clubs>
Shared Example Group: "a deck" called from /tmp/d20151112-27349-1fd5grw/spec.rb:191
# /tmp/d20151112-27349-1fd5grw/spec.rb:43: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) BeloteDeck behaves like a deck #bottom peeks at the bottom-most card
Failure/Error: expect(small_deck.bottom_card).to eq nine_of_clubs
expected: #<Card:0x007f4b4f908e30 @rank=9, @suit=:clubs>
got: #<Card:0x007f4b4f908e80 @rank=:ace, @suit=:spades>
(compared using ==)
Diff:
@@ -1,2 +1,2 @@
-#<Card:0x007f4b4f908e30 @rank=9, @suit=:clubs>
+#<Card:0x007f4b4f908e80 @rank=:ace, @suit=:spades>
Shared Example Group: "a deck" called from /tmp/d20151112-27349-1fd5grw/spec.rb:191
# /tmp/d20151112-27349-1fd5grw/spec.rb:50: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) BeloteDeck #sort sorts the cards in the defined order
Failure/Error: expect(deck.sort.to_a).to eq [jack_of_spades, ten_of_hearts, ace_of_clubs, seven_of_clubs]
expected: [#<Card:0x007f4b4f8daaf8 @rank=:jack, @suit=:spades>, #<Card:0x007f4b4f8daa30 @rank=10, @suit=:hearts>, #<Card:0x007f4b4f8dab20 @rank=:ace, @suit=:clubs>, #<Card:0x007f4b4f8daaa8 @rank=7, @suit=:clubs>]
got: [#<Card:0x007f4b4f8dab20 @rank=:ace, @suit=:clubs>, #<Card:0x007f4b4f8daaa8 @rank=7, @suit=:clubs>, #<Card:0x007f4b4f8daa30 @rank=10, @suit=:hearts>, #<Card:0x007f4b4f8daaf8 @rank=:jack, @suit=:spades>]
(compared using ==)
Diff:
@@ -1,5 +1,5 @@
-[#<Card:0x007f4b4f8daaf8 @rank=:jack, @suit=:spades>,
+[#<Card:0x007f4b4f8dab20 @rank=:ace, @suit=:clubs>,
+ #<Card:0x007f4b4f8daaa8 @rank=7, @suit=:clubs>,
#<Card:0x007f4b4f8daa30 @rank=10, @suit=:hearts>,
- #<Card:0x007f4b4f8dab20 @rank=:ace, @suit=:clubs>,
- #<Card:0x007f4b4f8daaa8 @rank=7, @suit=:clubs>]
+ #<Card:0x007f4b4f8daaf8 @rank=:jack, @suit=:spades>]
# /tmp/d20151112-27349-1fd5grw/spec.rb:206: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)>'
14) BeloteDeck hand #highest_of_suit returns the strongest card of the specified suit
Failure/Error: expect(hand.highest_of_suit(:clubs)).to eq Card.new(:ace, :clubs)
expected: #<Card:0x007f4b4f840728 @rank=:ace, @suit=:clubs>
got: #<Card:0x007f4b4f8402a0 @rank=:ace, @suit=:clubs>
(compared using ==)
Diff:
@@ -1,2 +1,2 @@
-#<Card:0x007f4b4f840728 @rank=:ace, @suit=:clubs>
+#<Card:0x007f4b4f8402a0 @rank=:ace, @suit=:clubs>
# /tmp/d20151112-27349-1fd5grw/spec.rb:232: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) BeloteDeck hand #belote? returns true if there is a king and a queen of the same suit
Failure/Error: expect(hand.belote?).to be true
NameError:
undefined local variable or method `suites' for #<BeloteHand:0x007f4b4f800128>
# /tmp/d20151112-27349-1fd5grw/solution.rb:98:in `king_and_queen?'
# /tmp/d20151112-27349-1fd5grw/solution.rb:156:in `belote?'
# /tmp/d20151112-27349-1fd5grw/spec.rb:251: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)>'
16) BeloteDeck hand #belote? returns false when there is no king and queen of the same suit
Failure/Error: expect(hand.belote?).to be false
NameError:
undefined local variable or method `suites' for #<BeloteHand:0x007f4b4f64a090>
# /tmp/d20151112-27349-1fd5grw/solution.rb:98:in `king_and_queen?'
# /tmp/d20151112-27349-1fd5grw/solution.rb:156:in `belote?'
# /tmp/d20151112-27349-1fd5grw/spec.rb:266: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)>'
17) SixtySixDeck behaves like a deck fills the deck if no initialize parameters are given
Failure/Error: expect(deck.to_a).to match_array all_available_cards
expected collection contained: [#<Card:0x007f4b4effefb0 @rank=9, @suit=:clubs>, #<Card:0x007f4b4effef60 @rank=:jack, @suit=:clubs>, #<Card:0x007f4b4effef38 @rank=:queen, @suit=:clubs>, #<Card:0x007f4b4effeee8 @rank=:king, @suit=:clubs>, #<Card:0x007f4b4effeec0 @rank=10, @suit=:clubs>, #<Card:0x007f4b4effee98 @rank=:ace, @suit=:clubs>, #<Card:0x007f4b4effedd0 @rank=9, @suit=:diamonds>, #<Card:0x007f4b4effeda8 @rank=:jack, @suit=:diamonds>, #<Card:0x007f4b4effed80 @rank=:queen, @suit=:diamonds>, #<Card:0x007f4b4effed58 @rank=:king, @suit=:diamonds>, #<Card:0x007f4b4effed08 @rank=10, @suit=:diamonds>, #<Card:0x007f4b4effece0 @rank=:ace, @suit=:diamonds>, #<Card:0x007f4b4effecb8 @rank=9, @suit=:hearts>, #<Card:0x007f4b4effeba0 @rank=:jack, @suit=:hearts>, #<Card:0x007f4b4effe9c0 @rank=:queen, @suit=:hearts>, #<Card:0x007f4b4effe970 @rank=:king, @suit=:hearts>, #<Card:0x007f4b4effe920 @rank=10, @suit=:hearts>, #<Card:0x007f4b4effe8a8 @rank=:ace, @suit=:hearts>, #<Card:0x007f4b4effe768 @rank=9, @suit=:spades>, #<Card:0x007f4b4effe128 @rank=:jack, @suit=:spades>, #<Card:0x007f4b4efe29c8 @rank=:queen, @suit=:spades>, #<Card:0x007f4b4efe2950 @rank=:king, @suit=:spades>, #<Card:0x007f4b4efe2798 @rank=10, @suit=:spades>, #<Card:0x007f4b4efe26f8 @rank=:ace, @suit=:spades>]
actual collection contained: [#<Card:0x007f4b4f010d78 @rank=9, @suit=:spades>, #<Card:0x007f4b4f010d28 @rank=9, @suit=:hearts>, #<Card:0x007f4b4f010d00 @rank=9, @suit=:diamonds>, #<Card:0x007f4b4f010cd8 @rank=9, @suit=:clubs>, #<Card:0x007f4b4f010c88 @rank=:jack, @suit=:spades>, #<Card:0x007f4b4f010c60 @rank=:jack, @suit=:hearts>, #<Card:0x007f4b4f010be8 @rank=:jack, @suit=:diamonds>, #<Card:0x007f4b4f010b98 @rank=:jack, @suit=:clubs>, #<Card:0x007f4b4f010b70 @rank=:queen, @suit=:spades>, #<Card:0x007f4b4f010b48 @rank=:queen, @suit=:hearts>, #<Card:0x007f4b4f010b20 @rank=:queen, @suit=:diamonds>, #<Card:0x007f4b4f010ad0 @rank=:queen, @suit=:clubs>, #<Card:0x007f4b4f010aa8 @rank=:king, @suit=:spades>, #<Card:0x007f4b4f010a58 @rank=:king, @suit=:hearts>, #<Card:0x007f4b4f010a30 @rank=:king, @suit=:diamonds>, #<Card:0x007f4b4f010a08 @rank=:king, @suit=:clubs>, #<Card:0x007f4b4f0109e0 @rank=10, @suit=:spades>, #<Card:0x007f4b4f0108c8 @rank=10, @suit=:hearts>, #<Card:0x007f4b4f0108a0 @rank=10, @suit=:diamonds>, #<Card:0x007f4b4f010878 @rank=10, @suit=:clubs>, #<Card:0x007f4b4f010850 @rank=:ace, @suit=:spades>, #<Card:0x007f4b4f010800 @rank=:ace, @suit=:hearts>, #<Card:0x007f4b4f010788 @rank=:ace, @suit=:diamonds>, #<Card:0x007f4b4f010738 @rank=:ace, @suit=:clubs>]
the missing elements were: [#<Card:0x007f4b4effefb0 @rank=9, @suit=:clubs>, #<Card:0x007f4b4effef60 @rank=:jack, @suit=:clubs>, #<Card:0x007f4b4effef38 @rank=:queen, @suit=:clubs>, #<Card:0x007f4b4effeee8 @rank=:king, @suit=:clubs>, #<Card:0x007f4b4effeec0 @rank=10, @suit=:clubs>, #<Card:0x007f4b4effee98 @rank=:ace, @suit=:clubs>, #<Card:0x007f4b4effedd0 @rank=9, @suit=:diamonds>, #<Card:0x007f4b4effeda8 @rank=:jack, @suit=:diamonds>, #<Card:0x007f4b4effed80 @rank=:queen, @suit=:diamonds>, #<Card:0x007f4b4effed58 @rank=:king, @suit=:diamonds>, #<Card:0x007f4b4effed08 @rank=10, @suit=:diamonds>, #<Card:0x007f4b4effece0 @rank=:ace, @suit=:diamonds>, #<Card:0x007f4b4effecb8 @rank=9, @suit=:hearts>, #<Card:0x007f4b4effeba0 @rank=:jack, @suit=:hearts>, #<Card:0x007f4b4effe9c0 @rank=:queen, @suit=:hearts>, #<Card:0x007f4b4effe970 @rank=:king, @suit=:hearts>, #<Card:0x007f4b4effe920 @rank=10, @suit=:hearts>, #<Card:0x007f4b4effe8a8 @rank=:ace, @suit=:hearts>, #<Card:0x007f4b4effe768 @rank=9, @suit=:spades>, #<Card:0x007f4b4effe128 @rank=:jack, @suit=:spades>, #<Card:0x007f4b4efe29c8 @rank=:queen, @suit=:spades>, #<Card:0x007f4b4efe2950 @rank=:king, @suit=:spades>, #<Card:0x007f4b4efe2798 @rank=10, @suit=:spades>, #<Card:0x007f4b4efe26f8 @rank=:ace, @suit=:spades>]
the extra elements were: [#<Card:0x007f4b4f010d78 @rank=9, @suit=:spades>, #<Card:0x007f4b4f010d28 @rank=9, @suit=:hearts>, #<Card:0x007f4b4f010d00 @rank=9, @suit=:diamonds>, #<Card:0x007f4b4f010cd8 @rank=9, @suit=:clubs>, #<Card:0x007f4b4f010c88 @rank=:jack, @suit=:spades>, #<Card:0x007f4b4f010c60 @rank=:jack, @suit=:hearts>, #<Card:0x007f4b4f010be8 @rank=:jack, @suit=:diamonds>, #<Card:0x007f4b4f010b98 @rank=:jack, @suit=:clubs>, #<Card:0x007f4b4f010b70 @rank=:queen, @suit=:spades>, #<Card:0x007f4b4f010b48 @rank=:queen, @suit=:hearts>, #<Card:0x007f4b4f010b20 @rank=:queen, @suit=:diamonds>, #<Card:0x007f4b4f010ad0 @rank=:queen, @suit=:clubs>, #<Card:0x007f4b4f010aa8 @rank=:king, @suit=:spades>, #<Card:0x007f4b4f010a58 @rank=:king, @suit=:hearts>, #<Card:0x007f4b4f010a30 @rank=:king, @suit=:diamonds>, #<Card:0x007f4b4f010a08 @rank=:king, @suit=:clubs>, #<Card:0x007f4b4f0109e0 @rank=10, @suit=:spades>, #<Card:0x007f4b4f0108c8 @rank=10, @suit=:hearts>, #<Card:0x007f4b4f0108a0 @rank=10, @suit=:diamonds>, #<Card:0x007f4b4f010878 @rank=10, @suit=:clubs>, #<Card:0x007f4b4f010850 @rank=:ace, @suit=:spades>, #<Card:0x007f4b4f010800 @rank=:ace, @suit=:hearts>, #<Card:0x007f4b4f010788 @rank=:ace, @suit=:diamonds>, #<Card:0x007f4b4f010738 @rank=:ace, @suit=:clubs>]
Shared Example Group: "a deck" called from /tmp/d20151112-27349-1fd5grw/spec.rb:400
# /tmp/d20151112-27349-1fd5grw/spec.rb:18: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)>'
18) SixtySixDeck behaves like a deck #draw_top_card pops the top-most card
Failure/Error: expect(small_deck.draw_top_card).to eq ace_of_spades
expected: #<Card:0x007f4b4ec8abb8 @rank=:ace, @suit=:spades>
got: #<Card:0x007f4b4ec8ab90 @rank=9, @suit=:clubs>
(compared using ==)
Diff:
@@ -1,2 +1,2 @@
-#<Card:0x007f4b4ec8abb8 @rank=:ace, @suit=:spades>
+#<Card:0x007f4b4ec8ab90 @rank=9, @suit=:clubs>
Shared Example Group: "a deck" called from /tmp/d20151112-27349-1fd5grw/spec.rb:400
# /tmp/d20151112-27349-1fd5grw/spec.rb:29: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)>'
19) SixtySixDeck behaves like a deck #draw_bottom_card pops the bottom-most card
Failure/Error: expect(small_deck.draw_bottom_card).to eq nine_of_clubs
expected: #<Card:0x007f4b4ec63270 @rank=9, @suit=:clubs>
got: #<Card:0x007f4b4ec63298 @rank=:ace, @suit=:spades>
(compared using ==)
Diff:
@@ -1,2 +1,2 @@
-#<Card:0x007f4b4ec63270 @rank=9, @suit=:clubs>
+#<Card:0x007f4b4ec63298 @rank=:ace, @suit=:spades>
Shared Example Group: "a deck" called from /tmp/d20151112-27349-1fd5grw/spec.rb:400
# /tmp/d20151112-27349-1fd5grw/spec.rb:36: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)>'
20) SixtySixDeck behaves like a deck #top peeks at the top-most card
Failure/Error: expect(small_deck.top_card).to eq ace_of_spades
expected: #<Card:0x007f4b4ec5d190 @rank=:ace, @suit=:spades>
got: #<Card:0x007f4b4ec5d140 @rank=9, @suit=:clubs>
(compared using ==)
Diff:
@@ -1,2 +1,2 @@
-#<Card:0x007f4b4ec5d190 @rank=:ace, @suit=:spades>
+#<Card:0x007f4b4ec5d140 @rank=9, @suit=:clubs>
Shared Example Group: "a deck" called from /tmp/d20151112-27349-1fd5grw/spec.rb:400
# /tmp/d20151112-27349-1fd5grw/spec.rb:43: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)>'
21) SixtySixDeck behaves like a deck #bottom peeks at the bottom-most card
Failure/Error: expect(small_deck.bottom_card).to eq nine_of_clubs
expected: #<Card:0x007f4b4ec96760 @rank=9, @suit=:clubs>
got: #<Card:0x007f4b4ec967d8 @rank=:ace, @suit=:spades>
(compared using ==)
Diff:
@@ -1,2 +1,2 @@
-#<Card:0x007f4b4ec96760 @rank=9, @suit=:clubs>
+#<Card:0x007f4b4ec967d8 @rank=:ace, @suit=:spades>
Shared Example Group: "a deck" called from /tmp/d20151112-27349-1fd5grw/spec.rb:400
# /tmp/d20151112-27349-1fd5grw/spec.rb:50: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)>'
22) SixtySixDeck #sort sorts the cards in the defined order
Failure/Error: expect(deck.sort.to_a).to eq [jack_of_spades, ten_of_hearts, ace_of_clubs, two_of_clubs]
expected: [#<Card:0x007f4b4ef67ca0 @rank=:jack, @suit=:spades>, #<Card:0x007f4b4ef67bb0 @rank=10, @suit=:hearts>, #<Card:0x007f4b4ef6c160 @rank=:ace, @suit=:clubs>, #<Card:0x007f4b4ef67c00 @rank=9, @suit=:clubs>]
got: [#<Card:0x007f4b4ef6c160 @rank=:ace, @suit=:clubs>, #<Card:0x007f4b4ef67c00 @rank=9, @suit=:clubs>, #<Card:0x007f4b4ef67bb0 @rank=10, @suit=:hearts>, #<Card:0x007f4b4ef67ca0 @rank=:jack, @suit=:spades>]
(compared using ==)
Diff:
@@ -1,5 +1,5 @@
-[#<Card:0x007f4b4ef67ca0 @rank=:jack, @suit=:spades>,
+[#<Card:0x007f4b4ef6c160 @rank=:ace, @suit=:clubs>,
+ #<Card:0x007f4b4ef67c00 @rank=9, @suit=:clubs>,
#<Card:0x007f4b4ef67bb0 @rank=10, @suit=:hearts>,
- #<Card:0x007f4b4ef6c160 @rank=:ace, @suit=:clubs>,
- #<Card:0x007f4b4ef67c00 @rank=9, @suit=:clubs>]
+ #<Card:0x007f4b4ef67ca0 @rank=:jack, @suit=:spades>]
# /tmp/d20151112-27349-1fd5grw/spec.rb:415: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)>'
23) SixtySixDeck hand #twenty? returns true for king and queen not of the trump suit
Failure/Error: expect(hand.twenty?(:hearts)).to be true
NameError:
undefined local variable or method `suites' for #<SixtySixHand:0x007f4b4f442310>
# /tmp/d20151112-27349-1fd5grw/solution.rb:98:in `king_and_queen?'
# /tmp/d20151112-27349-1fd5grw/solution.rb:212:in `twenty?'
# /tmp/d20151112-27349-1fd5grw/spec.rb:439: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)>'
24) SixtySixDeck hand #twenty? returns false for king and queen of the trump suit
Failure/Error: expect(hand.twenty?(:clubs)).to be false
NameError:
undefined local variable or method `suites' for #<SixtySixHand:0x007f4b4f4bdee8>
# /tmp/d20151112-27349-1fd5grw/solution.rb:98:in `king_and_queen?'
# /tmp/d20151112-27349-1fd5grw/solution.rb:212:in `twenty?'
# /tmp/d20151112-27349-1fd5grw/spec.rb:452: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)>'
25) SixtySixDeck hand #twenty? returns false for hands without a king and queen of the same suit
Failure/Error: expect(hand.twenty?(:hearts)).to be false
NameError:
undefined local variable or method `suites' for #<SixtySixHand:0x007f4b4f4af690>
# /tmp/d20151112-27349-1fd5grw/solution.rb:98:in `king_and_queen?'
# /tmp/d20151112-27349-1fd5grw/solution.rb:212:in `twenty?'
# /tmp/d20151112-27349-1fd5grw/spec.rb:465: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.06146 seconds
57 examples, 25 failures
Failed examples:
rspec /tmp/d20151112-27349-1fd5grw/spec.rb:130 # Card #== compares two cards by their rank and suit
rspec /tmp/d20151112-27349-1fd5grw/spec.rb:14 # WarDeck behaves like a deck fills the deck if no initialize parameters are given
rspec /tmp/d20151112-27349-1fd5grw/spec.rb:28 # WarDeck behaves like a deck #draw_top_card pops the top-most card
rspec /tmp/d20151112-27349-1fd5grw/spec.rb:35 # WarDeck behaves like a deck #draw_bottom_card pops the bottom-most card
rspec /tmp/d20151112-27349-1fd5grw/spec.rb:42 # WarDeck behaves like a deck #top peeks at the top-most card
rspec /tmp/d20151112-27349-1fd5grw/spec.rb:49 # WarDeck behaves like a deck #bottom peeks at the bottom-most card
rspec /tmp/d20151112-27349-1fd5grw/spec.rb:145 # WarDeck #sort sorts the cards in the defined order
rspec /tmp/d20151112-27349-1fd5grw/spec.rb:14 # BeloteDeck behaves like a deck fills the deck if no initialize parameters are given
rspec /tmp/d20151112-27349-1fd5grw/spec.rb:28 # BeloteDeck behaves like a deck #draw_top_card pops the top-most card
rspec /tmp/d20151112-27349-1fd5grw/spec.rb:35 # BeloteDeck behaves like a deck #draw_bottom_card pops the bottom-most card
rspec /tmp/d20151112-27349-1fd5grw/spec.rb:42 # BeloteDeck behaves like a deck #top peeks at the top-most card
rspec /tmp/d20151112-27349-1fd5grw/spec.rb:49 # BeloteDeck behaves like a deck #bottom peeks at the bottom-most card
rspec /tmp/d20151112-27349-1fd5grw/spec.rb:196 # BeloteDeck #sort sorts the cards in the defined order
rspec /tmp/d20151112-27349-1fd5grw/spec.rb:220 # BeloteDeck hand #highest_of_suit returns the strongest card of the specified suit
rspec /tmp/d20151112-27349-1fd5grw/spec.rb:239 # BeloteDeck hand #belote? returns true if there is a king and a queen of the same suit
rspec /tmp/d20151112-27349-1fd5grw/spec.rb:254 # BeloteDeck hand #belote? returns false when there is no king and queen of the same suit
rspec /tmp/d20151112-27349-1fd5grw/spec.rb:14 # SixtySixDeck behaves like a deck fills the deck if no initialize parameters are given
rspec /tmp/d20151112-27349-1fd5grw/spec.rb:28 # SixtySixDeck behaves like a deck #draw_top_card pops the top-most card
rspec /tmp/d20151112-27349-1fd5grw/spec.rb:35 # SixtySixDeck behaves like a deck #draw_bottom_card pops the bottom-most card
rspec /tmp/d20151112-27349-1fd5grw/spec.rb:42 # SixtySixDeck behaves like a deck #top peeks at the top-most card
rspec /tmp/d20151112-27349-1fd5grw/spec.rb:49 # SixtySixDeck behaves like a deck #bottom peeks at the bottom-most card
rspec /tmp/d20151112-27349-1fd5grw/spec.rb:405 # SixtySixDeck #sort sorts the cards in the defined order
rspec /tmp/d20151112-27349-1fd5grw/spec.rb:429 # SixtySixDeck hand #twenty? returns true for king and queen not of the trump suit
rspec /tmp/d20151112-27349-1fd5grw/spec.rb:442 # SixtySixDeck hand #twenty? returns false for king and queen of the trump suit
rspec /tmp/d20151112-27349-1fd5grw/spec.rb:455 # SixtySixDeck hand #twenty? returns false for hands without a king and queen of the same suit
История (3 версии и 3 коментара)
Мартина обнови решението на 06.11.2015 21:52 (преди около 9 години)
Мартина обнови решението на 08.11.2015 12:45 (преди около 9 години)
Мартина обнови решението на 11.11.2015 16:13 (преди около 9 години)