summaryrefslogtreecommitdiff
path: root/sw-engine/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'sw-engine/src/test')
-rw-r--r--sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/RequirementsTest.kt33
1 files changed, 33 insertions, 0 deletions
diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/RequirementsTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/RequirementsTest.kt
index 36dc8ed1..20100537 100644
--- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/RequirementsTest.kt
+++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/RequirementsTest.kt
@@ -128,6 +128,39 @@ class RequirementsTest {
}
@Theory
+ fun allTransactionOptionsAreValid(
+ initialResource: ResourceType,
+ boughtResource: ResourceType,
+ requiredResource: ResourceType,
+ ) {
+ assumeTrue(initialResource != requiredResource)
+
+ val requirements = createRequirements(requiredResource)
+
+ val board = testBoard(initialResource, 1)
+ board.tradingRules.setCost(boughtResource, Provider.RIGHT_PLAYER, 1)
+
+ val leftNeighbourBoard = testBoard(initialResource, 0)
+ leftNeighbourBoard.publicProduction.addFixedResource(boughtResource, 1)
+
+ val rightNeighbourBoard = testBoard(initialResource, 0)
+ rightNeighbourBoard.publicProduction.addFixedResource(boughtResource, 1)
+
+ val table = Table(listOf(leftNeighbourBoard, board, rightNeighbourBoard))
+ val player = SimplePlayer(0, table)
+
+ val satisfaction = requirements.assess(player)
+ if (satisfaction.satisfied) {
+ satisfaction.transactionOptions.forEach {
+ assertTrue(
+ requirements.areMetWithHelpBy(board, it),
+ "all transaction options should be valid, but this is not: $it"
+ )
+ }
+ }
+ }
+
+ @Theory
fun pay_boughtResource(initialResource: ResourceType, requiredResource: ResourceType) {
assumeTrue(initialResource != requiredResource)
bgstack15