cardshark 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/rspec.yml +20 -0
- data/.gitignore +1 -0
- data/.rspec +1 -0
- data/.rubocop.yml +20 -0
- data/Gemfile +2 -2
- data/Guardfile +23 -0
- data/LICENSE +19 -0
- data/README.md +49 -0
- data/Rakefile +2 -0
- data/cardshark.gemspec +20 -13
- data/lib/cardshark.rb +8 -1
- data/lib/cardshark/abstract.rb +30 -0
- data/lib/cardshark/card.rb +31 -6
- data/lib/cardshark/deck.rb +72 -25
- data/lib/cardshark/dimension.rb +57 -0
- data/lib/cardshark/error.rb +11 -0
- data/lib/cardshark/version.rb +3 -1
- data/spec/cardshark/abstract_spec.rb +27 -0
- data/spec/cardshark/card_spec.rb +86 -0
- data/spec/cardshark/deck_spec.rb +252 -0
- data/spec/cardshark/dimension_spec.rb +113 -0
- data/spec/cardshark/error/abstract_class_spec.rb +21 -0
- data/spec/cardshark/error_spec.rb +21 -0
- data/spec/cardshark_spec.rb +6 -0
- data/spec/spec_helper.rb +20 -0
- metadata +117 -78
- data/README +0 -8
- data/lib/cardshark/canasta_deck.rb +0 -21
- data/lib/cardshark/french_deck.rb +0 -20
- data/lib/cardshark/piquet_deck.rb +0 -16
- data/lib/cardshark/uno_deck.rb +0 -20
- data/spec/canasta_deck_spec.rb +0 -13
- data/spec/card_spec.rb +0 -15
- data/spec/deck_spec.rb +0 -39
- data/spec/french_deck_spec.rb +0 -17
- data/spec/piquet_deck_spec.rb +0 -13
- data/spec/uno_deck_spec.rb +0 -47
data/spec/french_deck_spec.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'cardshark/french_deck'
|
2
|
-
|
3
|
-
describe Cardshark::FrenchDeck do
|
4
|
-
#create a french (standard) deck
|
5
|
-
before :all do
|
6
|
-
@french = Cardshark::FrenchDeck.new
|
7
|
-
@french_with_jokers = Cardshark::FrenchDeck.new(:include_jokers => true)
|
8
|
-
end
|
9
|
-
|
10
|
-
it 'should contain 52 cards' do
|
11
|
-
@french.size.should == 52
|
12
|
-
end
|
13
|
-
|
14
|
-
it 'should contain 54 cards' do
|
15
|
-
@french_with_jokers.size == 54
|
16
|
-
end
|
17
|
-
end
|
data/spec/piquet_deck_spec.rb
DELETED
data/spec/uno_deck_spec.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'cardshark/uno_deck'
|
2
|
-
|
3
|
-
describe Cardshark::UnoDeck do
|
4
|
-
#create a uno deck
|
5
|
-
before :all do
|
6
|
-
@uno = Cardshark::UnoDeck.new
|
7
|
-
end
|
8
|
-
|
9
|
-
it 'should contain 108 cards' do
|
10
|
-
@uno.size.should == 108
|
11
|
-
end
|
12
|
-
|
13
|
-
it 'should contain one zero in each suit' do
|
14
|
-
zeros = Hash.new
|
15
|
-
Cardshark::UnoDeck::SUITS.each do |suit|
|
16
|
-
zeros[suit] = 0
|
17
|
-
end
|
18
|
-
@uno.cards.each do |card|
|
19
|
-
if card.rank == :zero then
|
20
|
-
zeros[card.suit] += 1
|
21
|
-
end
|
22
|
-
end
|
23
|
-
Cardshark::UnoDeck::SUITS.each do |suit|
|
24
|
-
zeros[suit].should == 1
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
it 'should contain two of each rank other than zero in each suit' do
|
29
|
-
cards = Hash.new
|
30
|
-
Cardshark::UnoDeck::RANKS.each do |rank|
|
31
|
-
cards[rank] = Hash.new
|
32
|
-
Cardshark::UnoDeck::SUITS.each do |suit|
|
33
|
-
cards[rank][suit] = 0
|
34
|
-
end
|
35
|
-
end
|
36
|
-
@uno.cards.each do |card|
|
37
|
-
if Cardshark::UnoDeck::RANKS.include?(card.rank)
|
38
|
-
cards[card.rank][card.suit] += 1
|
39
|
-
end
|
40
|
-
end
|
41
|
-
Cardshark::UnoDeck::RANKS.each do |rank|
|
42
|
-
Cardshark::UnoDeck::SUITS.each do |suit|
|
43
|
-
cards[rank][suit].should == 2 unless rank == :zero
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|