diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2023-09-13 16:43:42 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2023-09-13 16:43:42 +0200 |
commit | e6522764e28c505c314e413f369ab7a42af07cc5 (patch) | |
tree | 62ab93045924e3be5ddef010de5b6eacf19cce0b /spec | |
parent | 8d2dcd9113c5d970cb336bee0efe73e7cdccc92a (diff) | |
download | colonial-twilight-e6522764e28c505c314e413f369ab7a42af07cc5.zip colonial-twilight-e6522764e28c505c314e413f369ab7a42af07cc5.tar.gz |
Board : improve specs
Diffstat (limited to 'spec')
-rw-r--r-- | spec/board_spec.rb | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/spec/board_spec.rb b/spec/board_spec.rb index d1defd4..a9e0f1e 100644 --- a/spec/board_spec.rb +++ b/spec/board_spec.rb @@ -23,7 +23,6 @@ def compute(board) end describe ColonialTwilight::Board do - describe 'board setup' do board = ColonialTwilight::Board.new it 'has spaces' do expect(board.spaces.size).to eq(30) end @@ -59,6 +58,23 @@ describe ColonialTwilight::Board do it 'total FLN undergound' do expect(vals[9]).to eq(17) end it 'total FLN bases' do expect(vals[10]).to eq(8) end it 'oppositon + bases' do expect(board.opposition_bases).to eq(19) end - it 'support + commitment' do expect(board.support_commitment).to eq (22) end + it 'support + commitment' do expect(board.support_commitment).to eq(22) end + end + + describe 'has / count' do + board = ColonialTwilight::Board.new + board.load :short + it 'count fln_bases' do expect(board.count(&:fln_bases)).to eq(8) end + it 'count fln with bases' do expect(board.count { |s| s.fln_bases_0? ? 0 : s.guerrillas }).to eq(13) end + it 'count fln without bases' do expect(board.count { |s| s.fln_bases_0? ? s.guerrillas : 0 }).to eq(4) end + it 'count fln in country' do expect(board.count { |s| s.country? ? s.guerrillas : 0 }).to eq(9) end + it 'has fln 0 pop' do expect(board.search { |s| s.pop0? && s.fln.positive? }.size).to eq(2) end + it 'has fln 0 pop' do expect(board.search { |s| s.pop == 1 && s.fln.positive? }.size).to eq(4) end + it 'has fln 0 pop' do expect(board.search { |s| s.pop == 2 && s.fln.positive? }.size).to eq(4) end + it 'has fln 0 pop' do expect(board.search { |s| s.pop == 3 && s.fln.positive? }.size).to eq(0) end + it 'has fln 0 pop' do expect(board.has { |s| s.pop0? && s.fln.positive? }).to be true end + it 'has fln 0 pop' do expect(board.has { |s| s.pop == 1 && s.fln.positive? }).to be true end + it 'has fln 0 pop' do expect(board.has { |s| s.pop == 2 && s.fln.positive? }).to be true end + it 'has fln 0 pop' do expect(board.has { |s| s.pop == 3 && s.fln.positive? }).to be false end end end |