Решение на Четвърта задача от Алекс Николов
Обратно към всички решения
Към профила на Алекс Николов
Резултати
- 4 точки от тестове
- 0 бонус точки
- 4 точки общо
- 42 успешни тест(а)
- 15 неуспешни тест(а)
Код
Лог от изпълнението
...........F............F..FFF.......FFFFFF........F..FFF
Failures:
1) WarDeck behaves like a deck #to_s returns the names of the cards, each on its own line
Failure/Error: expect(small_deck.to_s.strip).to eq "Ace of Spades\n9 of Clubs"
NoMethodError:
undefined method `strip' for #<Array:0x007f0633c8e7f0>
Shared Example Group: "a deck" called from /tmp/d20151112-27349-1nbyzx3/spec.rb:140
# /tmp/d20151112-27349-1nbyzx3/spec.rb:68: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) BeloteDeck behaves like a deck #to_s returns the names of the cards, each on its own line
Failure/Error: expect(small_deck.to_s.strip).to eq "Ace of Spades\n9 of Clubs"
NoMethodError:
undefined method `strip' for #<Array:0x007f0633b943b8>
Shared Example Group: "a deck" called from /tmp/d20151112-27349-1nbyzx3/spec.rb:191
# /tmp/d20151112-27349-1nbyzx3/spec.rb:68:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (3 levels) in <top (required)>'
# ./lib/language/ruby/run_with_timeout.rb:5:in `block (2 levels) in <top (required)>'
3) 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)
NameError:
undefined local variable or method `same_suit_card' for #<BeloteHand:0x007f0633b41d70>
# /tmp/d20151112-27349-1nbyzx3/solution.rb:161:in `highest_of_suit'
# /tmp/d20151112-27349-1nbyzx3/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)>'
4) 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
NoMethodError:
undefined method `belote?' for KingsAndQueensMethods:Module
# /tmp/d20151112-27349-1nbyzx3/solution.rb:165:in `belote?'
# /tmp/d20151112-27349-1nbyzx3/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)>'
5) BeloteDeck hand #belote? returns false when there is no king and queen of the same suit
Failure/Error: expect(hand.belote?).to be false
NoMethodError:
undefined method `belote?' for KingsAndQueensMethods:Module
# /tmp/d20151112-27349-1nbyzx3/solution.rb:165:in `belote?'
# /tmp/d20151112-27349-1nbyzx3/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)>'
6) BeloteDeck hand #carre_of_jacks? behaves like carre-checking method returns true when there is a carre
Failure/Error: expect(hand.public_send(method)).to be true
expected #<TrueClass:20> => true
got #<Fixnum:9> => 4
Compared using equal?, which compares object identity,
but expected and actual are not the same object. Use
`expect(actual).to eq(expected)` if you don't care about
object identity in this example.
Shared Example Group: "carre-checking method" called from /tmp/d20151112-27349-1nbyzx3/spec.rb:386
# /tmp/d20151112-27349-1nbyzx3/spec.rb:86: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)>'
7) BeloteDeck hand #carre_of_jacks? behaves like carre-checking method returns false when there is no carre
Failure/Error: expect(hand.public_send(method)).to be false
expected #<FalseClass:0> => false
got #<Fixnum:7> => 3
Compared using equal?, which compares object identity,
but expected and actual are not the same object. Use
`expect(actual).to eq(expected)` if you don't care about
object identity in this example.
Shared Example Group: "carre-checking method" called from /tmp/d20151112-27349-1nbyzx3/spec.rb:386
# /tmp/d20151112-27349-1nbyzx3/spec.rb:101: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)>'
8) BeloteDeck hand #carre_of_nines? behaves like carre-checking method returns true when there is a carre
Failure/Error: expect(hand.public_send(method)).to be true
expected #<TrueClass:20> => true
got #<Fixnum:9> => 4
Compared using equal?, which compares object identity,
but expected and actual are not the same object. Use
`expect(actual).to eq(expected)` if you don't care about
object identity in this example.
Shared Example Group: "carre-checking method" called from /tmp/d20151112-27349-1nbyzx3/spec.rb:390
# /tmp/d20151112-27349-1nbyzx3/spec.rb:86: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 hand #carre_of_nines? behaves like carre-checking method returns false when there is no carre
Failure/Error: expect(hand.public_send(method)).to be false
expected #<FalseClass:0> => false
got #<Fixnum:7> => 3
Compared using equal?, which compares object identity,
but expected and actual are not the same object. Use
`expect(actual).to eq(expected)` if you don't care about
object identity in this example.
Shared Example Group: "carre-checking method" called from /tmp/d20151112-27349-1nbyzx3/spec.rb:390
# /tmp/d20151112-27349-1nbyzx3/spec.rb:101: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)>'
10) BeloteDeck hand #carre_of_aces? behaves like carre-checking method returns true when there is a carre
Failure/Error: expect(hand.public_send(method)).to be true
expected #<TrueClass:20> => true
got #<Fixnum:9> => 4
Compared using equal?, which compares object identity,
but expected and actual are not the same object. Use
`expect(actual).to eq(expected)` if you don't care about
object identity in this example.
Shared Example Group: "carre-checking method" called from /tmp/d20151112-27349-1nbyzx3/spec.rb:394
# /tmp/d20151112-27349-1nbyzx3/spec.rb:86: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)>'
11) BeloteDeck hand #carre_of_aces? behaves like carre-checking method returns false when there is no carre
Failure/Error: expect(hand.public_send(method)).to be false
expected #<FalseClass:0> => false
got #<Fixnum:7> => 3
Compared using equal?, which compares object identity,
but expected and actual are not the same object. Use
`expect(actual).to eq(expected)` if you don't care about
object identity in this example.
Shared Example Group: "carre-checking method" called from /tmp/d20151112-27349-1nbyzx3/spec.rb:394
# /tmp/d20151112-27349-1nbyzx3/spec.rb:101: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)>'
12) SixtySixDeck behaves like a deck #to_s returns the names of the cards, each on its own line
Failure/Error: expect(small_deck.to_s.strip).to eq "Ace of Spades\n9 of Clubs"
NoMethodError:
undefined method `strip' for #<Array:0x007f0633976b30>
Shared Example Group: "a deck" called from /tmp/d20151112-27349-1nbyzx3/spec.rb:400
# /tmp/d20151112-27349-1nbyzx3/spec.rb:68: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) SixtySixDeck hand #twenty? returns true for king and queen not of the trump suit
Failure/Error: expect(hand.twenty?(:hearts)).to be true
NoMethodError:
undefined method `belote?' for KingsAndQueensMethods:Module
# /tmp/d20151112-27349-1nbyzx3/solution.rb:239:in `twenty?'
# /tmp/d20151112-27349-1nbyzx3/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)>'
14) SixtySixDeck hand #twenty? returns false for king and queen of the trump suit
Failure/Error: expect(hand.twenty?(:clubs)).to be false
NoMethodError:
undefined method `belote?' for KingsAndQueensMethods:Module
# /tmp/d20151112-27349-1nbyzx3/solution.rb:239:in `twenty?'
# /tmp/d20151112-27349-1nbyzx3/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)>'
15) 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
NoMethodError:
undefined method `belote?' for KingsAndQueensMethods:Module
# /tmp/d20151112-27349-1nbyzx3/solution.rb:239:in `twenty?'
# /tmp/d20151112-27349-1nbyzx3/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.03923 seconds
57 examples, 15 failures
Failed examples:
rspec /tmp/d20151112-27349-1nbyzx3/spec.rb:67 # WarDeck behaves like a deck #to_s returns the names of the cards, each on its own line
rspec /tmp/d20151112-27349-1nbyzx3/spec.rb:67 # BeloteDeck behaves like a deck #to_s returns the names of the cards, each on its own line
rspec /tmp/d20151112-27349-1nbyzx3/spec.rb:220 # BeloteDeck hand #highest_of_suit returns the strongest card of the specified suit
rspec /tmp/d20151112-27349-1nbyzx3/spec.rb:239 # BeloteDeck hand #belote? returns true if there is a king and a queen of the same suit
rspec /tmp/d20151112-27349-1nbyzx3/spec.rb:254 # BeloteDeck hand #belote? returns false when there is no king and queen of the same suit
rspec /tmp/d20151112-27349-1nbyzx3/spec.rb:74 # BeloteDeck hand #carre_of_jacks? behaves like carre-checking method returns true when there is a carre
rspec /tmp/d20151112-27349-1nbyzx3/spec.rb:89 # BeloteDeck hand #carre_of_jacks? behaves like carre-checking method returns false when there is no carre
rspec /tmp/d20151112-27349-1nbyzx3/spec.rb:74 # BeloteDeck hand #carre_of_nines? behaves like carre-checking method returns true when there is a carre
rspec /tmp/d20151112-27349-1nbyzx3/spec.rb:89 # BeloteDeck hand #carre_of_nines? behaves like carre-checking method returns false when there is no carre
rspec /tmp/d20151112-27349-1nbyzx3/spec.rb:74 # BeloteDeck hand #carre_of_aces? behaves like carre-checking method returns true when there is a carre
rspec /tmp/d20151112-27349-1nbyzx3/spec.rb:89 # BeloteDeck hand #carre_of_aces? behaves like carre-checking method returns false when there is no carre
rspec /tmp/d20151112-27349-1nbyzx3/spec.rb:67 # SixtySixDeck behaves like a deck #to_s returns the names of the cards, each on its own line
rspec /tmp/d20151112-27349-1nbyzx3/spec.rb:429 # SixtySixDeck hand #twenty? returns true for king and queen not of the trump suit
rspec /tmp/d20151112-27349-1nbyzx3/spec.rb:442 # SixtySixDeck hand #twenty? returns false for king and queen of the trump suit
rspec /tmp/d20151112-27349-1nbyzx3/spec.rb:455 # SixtySixDeck hand #twenty? returns false for hands without a king and queen of the same suit
История (2 версии и 1 коментар)
Алекс обнови решението на 06.11.2015 23:06 (преди около 9 години)
Алекс обнови решението на 08.11.2015 22:46 (преди около 9 години)