Skip to content

Commit 742e865

Browse files
committed
Separating acceptance tests from unit tests
1 parent abd136c commit 742e865

File tree

3 files changed

+22
-19
lines changed

3 files changed

+22
-19
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
language: clojure
22
lein: lein2
3-
script: lein2 test
3+
script: lein2 test :all

project.clj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,7 @@
1414
:main ^:skip-aot civs.core
1515
:target-path "target/%s"
1616
:profiles {:uberjar {:aot :all}}
17-
:repositories {"sonartype snapshots" "https://oss.sonatype.org/content/repositories/snapshots"})
17+
:repositories {"sonartype snapshots" "https://oss.sonatype.org/content/repositories/snapshots"}
18+
:test-selectors {:default (complement :acceptance)
19+
:acceptance :acceptance
20+
:all (constantly true)})

test/civs/acceptance_test.clj

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@
3434
(defn mock-prosperity-humidity-multiplier-at []
3535
(fn [world pos] 1.0))
3636

37-
(deftest test-not-everyone-dies-immediately
37+
(deftest ^:acceptance test-not-everyone-dies-immediately
3838
(with-redefs [crand-int (mock-crand-int)
3939
crand-float (mock-crand-float)]
4040
(let [g0 (generate-game w77 10)
4141
g (reduce (fn [g _] (turn g)) g0 (repeat 10 :_))]
4242
(is (> (game-total-pop g) 0)))))
4343

44-
(deftest test-population-do-not-expand-too-much-too-fast
44+
(deftest ^:acceptance test-population-do-not-expand-too-much-too-fast
4545
(with-redefs [crand-int (mock-crand-int)
4646
crand-float (mock-crand-float)]
4747
(let [g0 (generate-game w77 10)
@@ -67,29 +67,29 @@
6767
(is (> final-pop (* start-pop min-factor)))
6868
(is (< final-pop (* start-pop max-factor))))))
6969

70-
(deftest test-population-in-a-sand-desert
70+
(deftest ^:acceptance test-population-in-a-sand-desert
7171
(check-biome com.github.lands.Biome/SAND_DESERT 0.5 1.3 30 10))
7272

7373
; We do not want to drop too drammatically and it should not increase too much
74-
(deftest test-population-in-a-grassland
74+
(deftest ^:acceptance test-population-in-a-grassland
7575
(check-biome com.github.lands.Biome/GRASSLAND 0.9 1.8 30 10))
7676

7777
; We do not want to drop too drammatically and it should not increase too much
78-
(deftest test-population-in-a-savanna
78+
(deftest ^:acceptance test-population-in-a-savanna
7979
(check-biome com.github.lands.Biome/SAVANNA 0.9 1.5 30 10))
8080

8181
; We do not want to drop too drammatically and it should not increase too much
82-
(deftest test-population-in-a-forest
82+
(deftest ^:acceptance test-population-in-a-forest
8383
(check-biome com.github.lands.Biome/FOREST 0.9 1.6 30 10))
8484

8585
; We do not want to drop too drammatically and it should not increase too much
86-
(deftest test-population-in-a-jungle
86+
(deftest ^:acceptance test-population-in-a-jungle
8787
(check-biome com.github.lands.Biome/JUNGLE 0.9 1.7 30 10))
8888

89-
(deftest test-long-lasting-population-in-grassland
89+
(deftest ^:acceptance test-long-lasting-population-in-grassland
9090
(check-biome com.github.lands.Biome/GRASSLAND 2.0 1000.0 50 100))
9191

92-
(deftest test-long-lasting-population-in-savanna
92+
(deftest ^:acceptance test-long-lasting-population-in-savanna
9393
(check-biome com.github.lands.Biome/SAVANNA 0.8 10.0 50 100))
9494

9595
(def game-scenario-w77-100tribes-30turns
@@ -101,7 +101,7 @@
101101
g (reduce (fn [g _] (turn g)) g0 (repeat nturns :_))]
102102
g)))
103103

104-
(deftest test-some-societies-remain-nomadic
104+
(deftest ^:acceptance test-some-societies-remain-nomadic
105105
(let [ g game-scenario-w77-100tribes-30turns
106106
societies (groups-alive g)
107107
nsocieties-total (.size societies)
@@ -115,7 +115,7 @@
115115
(is (and (>= nsocieties-still-nomadic 10) (<= nsocieties-still-nomadic 60)))
116116
))
117117

118-
(deftest test-some-societies-become-semi-sedentary
118+
(deftest ^:acceptance test-some-societies-become-semi-sedentary
119119
(let [ g game-scenario-w77-100tribes-30turns
120120
societies (groups-alive g)
121121
nsocieties-total (.size societies)
@@ -125,7 +125,7 @@
125125
(is (and (>= nsocieties-semi-sedentary 10) (<= nsocieties-semi-sedentary 55)))
126126
))
127127

128-
(deftest test-some-societies-become-sedentary
128+
(deftest ^:acceptance test-some-societies-become-sedentary
129129
(let [ g game-scenario-w77-100tribes-30turns
130130
societies (groups-alive g)
131131
nsocieties-total (.size societies)
@@ -134,39 +134,39 @@
134134
nsocieties-sedentary (.size (filter sedentary? societies))]
135135
(is (and (>= nsocieties-sedentary 3) (<= nsocieties-sedentary 15)))))
136136

137-
(deftest test-some-discover-agriculture
137+
(deftest ^:acceptance test-some-discover-agriculture
138138
(let [ g game-scenario-w77-100tribes-30turns
139139
societies (groups-alive g)
140140
nsocieties-agriculture (.size (filter #(know? % :agriculture) societies))]
141141
(when verbose-acceptance-tests
142142
(println "scenario-w77-100tribes-30turns agriculture" nsocieties-agriculture))
143143
(is (and (>= nsocieties-agriculture 3) (<= nsocieties-agriculture 25)))))
144144

145-
(deftest test-some-most-do-not-discover-agriculture
145+
(deftest ^:acceptance test-some-most-do-not-discover-agriculture
146146
(let [ g game-scenario-w77-100tribes-30turns
147147
societies (groups-alive g)
148148
nsocieties-no-agriculture (.size (filter #(not (know? % :agriculture)) societies))]
149149
(when verbose-acceptance-tests
150150
(println "scenario-w77-100tribes-30turns no agriculture" nsocieties-no-agriculture))
151151
(is (and (>= nsocieties-no-agriculture 35) (<= nsocieties-no-agriculture 90)))))
152152

153-
(deftest test-some-societies-are-band
153+
(deftest ^:acceptance test-some-societies-are-band
154154
(let [ g game-scenario-w77-100tribes-30turns
155155
societies (groups-alive g)
156156
target (.size (filter band-society? societies))]
157157
(when verbose-acceptance-tests
158158
(println "scenario-w77-100tribes-30turns band" target))
159159
(is (and (>= target 10) (<= target 85)))))
160160

161-
(deftest test-some-societies-are-tribe
161+
(deftest ^:acceptance test-some-societies-are-tribe
162162
(let [ g game-scenario-w77-100tribes-30turns
163163
societies (groups-alive g)
164164
target (.size (filter tribe-society? societies))]
165165
(when verbose-acceptance-tests
166166
(println "scenario-w77-100tribes-30turns tribe" target))
167167
(is (and (>= target 5) (<= target 35)))))
168168

169-
(deftest test-no-societies-are-yet-chiefdom
169+
(deftest ^:acceptance test-no-societies-are-yet-chiefdom
170170
(let [ g game-scenario-w77-100tribes-30turns
171171
societies (groups-alive g)
172172
target (.size (filter chiefdom-society? societies))]

0 commit comments

Comments
 (0)