summaryrefslogtreecommitdiffstats
path: root/spec/fln_rules_spec.rb
blob: 486d3ecfc421751c532a98401ec07713c1f4eda5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# frozen_string_literal: true

require './lib/colonial_twilight/fln_rules'
require './lib/colonial_twilight/board'

class FLNRulesImpl
  include ColonialTwilight::FLNRules
end

describe ColonialTwilight::FLNRules do
  rules = FLNRulesImpl.new
  describe 'Rally' do
    board = ColonialTwilight::Board.new
    # 25 sectors + 3 cities
    it 'collects spaces where operation can be conducted' do expect(rules.rally_spaces(board).size).to eq(28) end
  end

  describe 'Rally' do
    board = ColonialTwilight::Board.new
    board.load :short
    # 25 sectors + 2 countries
    it 'collects spaces where operation can be conducted' do expect(rules.rally_spaces(board).size).to eq(27) end
  end

  describe 'Agitate' do
    board = ColonialTwilight::Board.new
    it 'collects spaces where operation can be conducted' do expect(rules.agitate_spaces(board.spaces).size).to eq(0) end
  end

  describe 'Agitate' do
    board = ColonialTwilight::Board.new
    board.load :short
    # 6 with bases + 1 in fln control
    it 'collects spaces where operation can be conducted' do expect(rules.agitate_spaces(board.spaces).size).to eq(5) end
  end

  describe 'Attack' do
    board = ColonialTwilight::Board.new
    # 25 sectors + 3 cities
    it 'collects spaces where operation can be conducted' do expect(rules.attack_spaces(board).size).to eq(0) end
  end

  describe 'Attack' do
    board = ColonialTwilight::Board.new
    board.load :short
    # 25 sectors + 2 countries
    it 'collects spaces where operation can be conducted' do expect(rules.attack_spaces(board).size).to eq(7) end
  end

  describe 'Terror' do
    board = ColonialTwilight::Board.new
    it 'collects spaces where operation can be conducted' do expect(rules.terror_spaces(board).size).to eq(0) end
  end

  describe 'Terror' do
    board = ColonialTwilight::Board.new
    board.load :short
    # 6 sectors
    it 'collects spaces where operation can be conducted' do expect(rules.terror_spaces(board).size).to eq(6) end
  end

  describe 'Extort' do
    board = ColonialTwilight::Board.new
    it 'collects spaces where operation can be conducted' do expect(rules.extort_spaces(board).size).to eq(0) end
  end

  describe 'Extort' do
    board = ColonialTwilight::Board.new
    board.load :short
    # 2 sectors
    it 'collects spaces where operation can be conducted' do expect(rules.extort_spaces(board).size).to eq(2) end
  end

  describe 'Subvert' do
    board = ColonialTwilight::Board.new
    it 'collects spaces where operation can be conducted' do expect(rules.subvert_spaces(board).size).to eq(0) end
  end

  describe 'Subvert' do
    board = ColonialTwilight::Board.new
    board.load :short
    # 4 sectors
    it 'collects spaces where operation can be conducted' do expect(rules.subvert_spaces(board).size).to eq(4) end
  end

  describe 'Ambush' do
    board = ColonialTwilight::Board.new
    # 25 sectors + 3 cities
    it 'collects spaces where operation can be conducted' do expect(rules.ambush_spaces(board).size).to eq(0) end
  end

  describe 'Ambush' do
    board = ColonialTwilight::Board.new
    board.load :short
    # 25 sectors + 2 countries
    it 'collects spaces where operation can be conducted' do expect(rules.ambush_spaces(board).size).to eq(7) end
  end

  describe 'OAS' do
    board = ColonialTwilight::Board.new
    # 14 sectors + 3 cities
    it 'collects spaces where operation can be conducted' do expect(rules.oas_spaces(board).size).to eq(17) end
  end

  describe 'OAS' do
    board = ColonialTwilight::Board.new
    board.load :short
    # 11 sectors + 3 countries
    it 'collects spaces where operation can be conducted' do expect(rules.oas_spaces(board).size).to eq(14) end
  end
end