summaryrefslogtreecommitdiff
path: root/sw-engine/src/test
diff options
context:
space:
mode:
authorJoffrey Bion <joffrey.bion@booking.com>2020-09-07 23:36:44 +0200
committerJoffrey Bion <joffrey.bion@booking.com>2020-09-08 00:39:01 +0200
commit9cb098df0ad5978b0e9aac78b4c68c9d16759f0f (patch)
treeb7c4829c163a004a012a3da13183753fe4ee32e6 /sw-engine/src/test
parentUse port 80 in docker image (diff)
downloadseven-wonders-9cb098df0ad5978b0e9aac78b4c68c9d16759f0f.tar.gz
seven-wonders-9cb098df0ad5978b0e9aac78b4c68c9d16759f0f.tar.bz2
seven-wonders-9cb098df0ad5978b0e9aac78b4c68c9d16759f0f.zip
Format with trailing comma
Diffstat (limited to 'sw-engine/src/test')
-rw-r--r--sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/GameTest.kt8
-rw-r--r--sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/boards/BoardTest.kt8
-rw-r--r--sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/boards/MilitaryTest.kt2
-rw-r--r--sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/boards/ScienceTest.kt2
-rw-r--r--sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/CardTest.kt2
-rw-r--r--sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/HandsTest.kt6
-rw-r--r--sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/RequirementsTest.kt6
-rw-r--r--sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/converters/BoardsKtTest.kt6
-rw-r--r--sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/NumericEffectSerializerTest.kt3
-rw-r--r--sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/ProductionSerializerTest.kt3
-rw-r--r--sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/ResourcesSerializerTest.kt2
-rw-r--r--sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/BonusPerBoardElementTest.kt6
-rw-r--r--sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/DiscountTest.kt2
-rw-r--r--sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/ProductionIncreaseTest.kt4
-rw-r--r--sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/ScienceProgressTest.kt2
-rw-r--r--sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/SpecialAbilityActivationTest.kt12
-rw-r--r--sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/resources/ResourceTransactionsTest.kt4
-rw-r--r--sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/resources/TradingRulesTest.kt10
-rw-r--r--sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/test/TestUtils.kt20
19 files changed, 55 insertions, 53 deletions
diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/GameTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/GameTest.kt
index 9e8e3e52..783d3eab 100644
--- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/GameTest.kt
+++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/GameTest.kt
@@ -107,7 +107,7 @@ class GameTest {
return MoveExpectation(
turn.playerIndex,
PlayerMove(MoveType.PLAY_FREE_DISCARDED, card.name, noTransactions()),
- PlayedMove(turn.playerIndex, MoveType.PLAY_FREE_DISCARDED, card.toPlayedCard(), noTransactions())
+ PlayedMove(turn.playerIndex, MoveType.PLAY_FREE_DISCARDED, card.toPlayedCard(), noTransactions()),
)
}
@@ -115,11 +115,11 @@ class GameTest {
turnInfo: PlayerTurnInfo,
moveType: MoveType,
card: HandCard,
- transactions: ResourceTransactions
+ transactions: ResourceTransactions,
): MoveExpectation = MoveExpectation(
turnInfo.playerIndex,
PlayerMove(moveType, card.name, transactions),
- PlayedMove(turnInfo.playerIndex, moveType, card.toPlayedCard(), transactions)
+ PlayedMove(turnInfo.playerIndex, moveType, card.toPlayedCard(), transactions),
)
private fun createPickGuildMove(turnInfo: PlayerTurnInfo): MoveExpectation {
@@ -131,7 +131,7 @@ class GameTest {
return MoveExpectation(
turnInfo.playerIndex,
PlayerMove(MoveType.COPY_GUILD, card.name),
- PlayedMove(turnInfo.playerIndex, MoveType.COPY_GUILD, card.toPlayedCard(), noTransactions())
+ PlayedMove(turnInfo.playerIndex, MoveType.COPY_GUILD, card.toPlayedCard(), noTransactions()),
)
}
diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/boards/BoardTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/boards/BoardTest.kt
index 165fbaa1..909d5e99 100644
--- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/boards/BoardTest.kt
+++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/boards/BoardTest.kt
@@ -50,7 +50,7 @@ class BoardTest {
@Theory
fun removeGold_successfulWhenNotTooMuch(
@FromDataPoints("gold") initialGold: Int,
- @FromDataPoints("gold") goldRemoved: Int
+ @FromDataPoints("gold") goldRemoved: Int,
) {
assumeTrue(goldRemoved >= 0)
assumeTrue(initialGold >= goldRemoved)
@@ -63,7 +63,7 @@ class BoardTest {
@Theory
fun removeGold_failsWhenTooMuch(
@FromDataPoints("gold") initialGold: Int,
- @FromDataPoints("gold") goldRemoved: Int
+ @FromDataPoints("gold") goldRemoved: Int,
) {
assumeTrue(goldRemoved >= 0)
assumeTrue(initialGold < goldRemoved)
@@ -79,7 +79,7 @@ class BoardTest {
type: ResourceType,
@FromDataPoints("nbCards") nbCards: Int,
@FromDataPoints("nbCards") nbOtherCards: Int,
- color: Color
+ color: Color,
) {
val board = testBoard(initialResource = type)
addCards(board, nbCards, nbOtherCards, color)
@@ -93,7 +93,7 @@ class BoardTest {
@FromDataPoints("nbCards") nbCards2: Int,
@FromDataPoints("nbCards") nbOtherCards: Int,
color1: Color,
- color2: Color
+ color2: Color,
) {
val board = testBoard(initialResource = type)
addCards(board, nbCards1, color1)
diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/boards/MilitaryTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/boards/MilitaryTest.kt
index 509d8670..a7aff760 100644
--- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/boards/MilitaryTest.kt
+++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/boards/MilitaryTest.kt
@@ -15,7 +15,7 @@ class MilitaryTest {
@Theory
fun victory_addsCorrectPoints(
@FromDataPoints("ages") age: Int,
- @FromDataPoints("points") nbPointsPerVictory: Int
+ @FromDataPoints("points") nbPointsPerVictory: Int,
) {
val military = createMilitary(age, nbPointsPerVictory, 0)
val initialPoints = military.totalPoints
diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/boards/ScienceTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/boards/ScienceTest.kt
index e3f6f47d..90d9ece3 100644
--- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/boards/ScienceTest.kt
+++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/boards/ScienceTest.kt
@@ -104,7 +104,7 @@ class ScienceTest {
intArrayOf(0, 0, 1, 3, 16),
intArrayOf(0, 0, 2, 2, 16),
intArrayOf(0, 0, 3, 1, 16),
- intArrayOf(0, 0, 4, 0, 16)
+ intArrayOf(0, 0, 4, 0, 16),
)
@JvmStatic
diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/CardTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/CardTest.kt
index 5f22acb3..414213c3 100644
--- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/CardTest.kt
+++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/CardTest.kt
@@ -25,7 +25,7 @@ class CardTest {
val boards = listOf(
Board(Wonder("TestWonder", ResourceType.WOOD, emptyList(), ""), 0, settings),
Board(Wonder("TestWonder", ResourceType.STONE, emptyList(), ""), 1, settings),
- Board(Wonder("TestWonder", ResourceType.PAPYRUS, emptyList(), ""), 2, settings)
+ Board(Wonder("TestWonder", ResourceType.PAPYRUS, emptyList(), ""), 2, settings),
)
val table = Table(boards)
diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/HandsTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/HandsTest.kt
index f7bb45c0..97920f3e 100644
--- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/HandsTest.kt
+++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/cards/HandsTest.kt
@@ -38,7 +38,7 @@ class HandsTest {
@Theory
fun isEmpty_falseWhenAtLeast1_allSame(
@FromDataPoints("nbPlayers") nbPlayers: Int,
- @FromDataPoints("nbCardsPerPlayer") nbCardsPerPlayer: Int
+ @FromDataPoints("nbCardsPerPlayer") nbCardsPerPlayer: Int,
) {
assumeTrue(nbCardsPerPlayer >= 1)
val hands = createHands(nbPlayers, nbCardsPerPlayer)
@@ -54,7 +54,7 @@ class HandsTest {
@Theory
fun maxOneCardRemains_falseWhenAtLeast2_allSame(
@FromDataPoints("nbPlayers") nbPlayers: Int,
- @FromDataPoints("nbCardsPerPlayer") nbCardsPerPlayer: Int
+ @FromDataPoints("nbCardsPerPlayer") nbCardsPerPlayer: Int,
) {
assumeTrue(nbCardsPerPlayer >= 2)
val hands = createHands(nbPlayers, nbCardsPerPlayer)
@@ -64,7 +64,7 @@ class HandsTest {
@Theory
fun maxOneCardRemains_trueWhenAtMost1_allSame(
@FromDataPoints("nbPlayers") nbPlayers: Int,
- @FromDataPoints("nbCardsPerPlayer") nbCardsPerPlayer: Int
+ @FromDataPoints("nbCardsPerPlayer") nbCardsPerPlayer: Int,
) {
assumeTrue(nbCardsPerPlayer <= 1)
val hands = createHands(nbPlayers, nbCardsPerPlayer)
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 889675a4..d2ef7930 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
@@ -76,7 +76,7 @@ class RequirementsTest {
fun resourceRequirement_ownProduction(
initialResource: ResourceType,
producedResource: ResourceType,
- requiredResource: ResourceType
+ requiredResource: ResourceType,
) {
assumeTrue(initialResource != requiredResource)
@@ -98,7 +98,7 @@ class RequirementsTest {
fun resourceRequirement_boughtResource(
initialResource: ResourceType,
boughtResource: ResourceType,
- requiredResource: ResourceType
+ requiredResource: ResourceType,
) {
assumeTrue(initialResource != requiredResource)
@@ -119,7 +119,7 @@ class RequirementsTest {
if (neighbourHasResource) {
val transactions = setOf(
createTransactions(Provider.LEFT_PLAYER, requiredResource),
- createTransactions(Provider.RIGHT_PLAYER, requiredResource)
+ createTransactions(Provider.RIGHT_PLAYER, requiredResource),
)
assertEquals(RequirementsSatisfaction.metWithHelp(2, transactions), satisfaction)
} else {
diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/converters/BoardsKtTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/converters/BoardsKtTest.kt
index c1b17d4a..3706b533 100644
--- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/converters/BoardsKtTest.kt
+++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/converters/BoardsKtTest.kt
@@ -74,11 +74,7 @@ class BoardsKtTest {
val green2 = testCard(color = Color.GREEN).toTableCard()
val cards = listOf(res1, green1, green2, res2, blue1, res3)
val cols = cards.toColumns()
- val expectedCols = listOf(
- listOf(res1, res2, res3),
- listOf(blue1),
- listOf(green1, green2)
- )
+ val expectedCols = listOf(listOf(res1, res2, res3), listOf(blue1), listOf(green1, green2))
assertEquals(expectedCols, cols)
}
}
diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/NumericEffectSerializerTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/NumericEffectSerializerTest.kt
index 6a399977..520db340 100644
--- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/NumericEffectSerializerTest.kt
+++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/NumericEffectSerializerTest.kt
@@ -28,7 +28,8 @@ class NumericEffectSerializerTest {
.registerTypeAdapter(RawPointsIncrease::class.java, NumericEffectSerializer())
.registerTypeAdapter(GoldIncrease::class.java, NumericEffectSerializer())
// ProductionIncrease is not a numeric effect, it is here for negative testing purpose
- .registerTypeAdapter(ProductionIncrease::class.java, NumericEffectSerializer()).create()
+ .registerTypeAdapter(ProductionIncrease::class.java, NumericEffectSerializer())
+ .create()
}
@Test
diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/ProductionSerializerTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/ProductionSerializerTest.kt
index 4a58e493..314bc43c 100644
--- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/ProductionSerializerTest.kt
+++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/ProductionSerializerTest.kt
@@ -25,7 +25,8 @@ class ProductionSerializerTest {
.registerTypeAdapter(MutableResources::class.java, ResourcesSerializer())
.registerTypeAdapter(ResourceType::class.java, ResourceTypeSerializer())
.registerTypeAdapter(resourceTypeList, ResourceTypesSerializer())
- .registerTypeAdapter(Production::class.java, ProductionSerializer()).create()
+ .registerTypeAdapter(Production::class.java, ProductionSerializer())
+ .create()
}
private fun create(wood: Int, stone: Int, clay: Int): Production {
diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/ResourcesSerializerTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/ResourcesSerializerTest.kt
index 8a7e4f98..bc5808a0 100644
--- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/ResourcesSerializerTest.kt
+++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/data/serializers/ResourcesSerializerTest.kt
@@ -21,7 +21,7 @@ class ResourcesSerializerTest {
@Before
fun setUp() {
- gson = GsonBuilder()
+ gson = GsonBuilder() //
.registerTypeAdapter(Resources::class.java, ResourcesSerializer())
.registerTypeAdapter(MutableResources::class.java, ResourcesSerializer())
.create()
diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/BonusPerBoardElementTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/BonusPerBoardElementTest.kt
index 1bb92f13..a40f9420 100644
--- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/BonusPerBoardElementTest.kt
+++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/BonusPerBoardElementTest.kt
@@ -34,7 +34,7 @@ class BonusPerBoardElementTest {
nbOtherCards: Int,
points: Int,
gold: Int,
- color: Color
+ color: Color,
) {
val board = table.getBoard(0, boardPosition)
addCards(board, nbCards, nbOtherCards, color)
@@ -49,7 +49,7 @@ class BonusPerBoardElementTest {
boardPosition: RelativeBoardPosition,
nbDefeatTokens: Int,
points: Int,
- gold: Int
+ gold: Int,
) {
val board = table.getBoard(0, boardPosition)
repeat(nbDefeatTokens) {
@@ -81,7 +81,7 @@ class BonusPerBoardElementTest {
nbOtherCards: Int,
points: Int,
gold: Int,
- color: Color
+ color: Color,
) {
val board = table.getBoard(0, boardPosition)
addCards(board, nbCards, nbOtherCards, color)
diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/DiscountTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/DiscountTest.kt
index 7df5ac35..64d6546a 100644
--- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/DiscountTest.kt
+++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/DiscountTest.kt
@@ -30,7 +30,7 @@ class DiscountTest {
discountedType: ResourceType,
provider: Provider,
otherType: ResourceType,
- otherProvider: Provider
+ otherProvider: Provider,
) {
Assume.assumeTrue(otherProvider != provider)
Assume.assumeTrue(otherType != discountedType)
diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/ProductionIncreaseTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/ProductionIncreaseTest.kt
index 699803d0..88fb57ad 100644
--- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/ProductionIncreaseTest.kt
+++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/ProductionIncreaseTest.kt
@@ -21,7 +21,7 @@ class ProductionIncreaseTest {
fun apply_boardContainsAddedResourceType(
initialType: ResourceType,
addedType: ResourceType,
- extraType: ResourceType
+ extraType: ResourceType,
) {
val board = testBoard(initialType)
val effect = ProductionIncrease(fixedProduction(addedType), false)
@@ -41,7 +41,7 @@ class ProductionIncreaseTest {
fun apply_boardContainsAddedResourceType_sellable(
initialType: ResourceType,
addedType: ResourceType,
- extraType: ResourceType
+ extraType: ResourceType,
) {
val board = testBoard(initialType)
val effect = ProductionIncrease(fixedProduction(addedType), true)
diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/ScienceProgressTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/ScienceProgressTest.kt
index 551018fc..7bf63988 100644
--- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/ScienceProgressTest.kt
+++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/ScienceProgressTest.kt
@@ -23,7 +23,7 @@ class ScienceProgressTest {
compasses: Int,
wheels: Int,
tablets: Int,
- jokers: Int
+ jokers: Int,
) {
val board = testBoard(ResourceType.ORE)
val initialScience = createScience(initCompasses, initWheels, initTablets, initJokers)
diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/SpecialAbilityActivationTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/SpecialAbilityActivationTest.kt
index 6931e38f..50be6c24 100644
--- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/SpecialAbilityActivationTest.kt
+++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/effects/SpecialAbilityActivationTest.kt
@@ -77,15 +77,15 @@ class SpecialAbilityActivationTest {
@DataPoints
internal fun guilds(): Array<Card> {
val bonus = BonusPerBoardElement(
- listOf(RelativeBoardPosition.LEFT, RelativeBoardPosition.RIGHT),
- BoardElementType.CARD,
+ boards = listOf(RelativeBoardPosition.LEFT, RelativeBoardPosition.RIGHT),
+ type = BoardElementType.CARD,
points = 1,
- colors = listOf(Color.GREY, Color.BROWN)
+ colors = listOf(Color.GREY, Color.BROWN),
)
val bonus2 = BonusPerBoardElement(
- listOf(RelativeBoardPosition.LEFT, RelativeBoardPosition.SELF, RelativeBoardPosition.RIGHT),
- BoardElementType.BUILT_WONDER_STAGES,
- points = 1
+ boards = listOf(RelativeBoardPosition.LEFT, RelativeBoardPosition.SELF, RelativeBoardPosition.RIGHT),
+ type = BoardElementType.BUILT_WONDER_STAGES,
+ points = 1,
)
return arrayOf(createGuildCard(1, bonus), createGuildCard(2, bonus2))
}
diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/resources/ResourceTransactionsTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/resources/ResourceTransactionsTest.kt
index 71c75d70..7b08be9a 100644
--- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/resources/ResourceTransactionsTest.kt
+++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/resources/ResourceTransactionsTest.kt
@@ -14,12 +14,12 @@ class ResourceTransactionsTest {
fun toTransactions() {
val transactionMap = mapOf(
Provider.LEFT_PLAYER to (1 of WOOD) + (1 of CLAY),
- Provider.RIGHT_PLAYER to (1 of WOOD)
+ Provider.RIGHT_PLAYER to (1 of WOOD),
)
val expectedNormalized = setOf(
createTransaction(Provider.LEFT_PLAYER, WOOD, CLAY),
- createTransaction(Provider.RIGHT_PLAYER, WOOD)
+ createTransaction(Provider.RIGHT_PLAYER, WOOD),
)
assertEquals(expectedNormalized, transactionMap.toTransactions().toSet())
diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/resources/TradingRulesTest.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/resources/TradingRulesTest.kt
index 0b2e5261..1ee329d3 100644
--- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/resources/TradingRulesTest.kt
+++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/resources/TradingRulesTest.kt
@@ -21,7 +21,7 @@ class TradingRulesTest {
overriddenCost: Int,
overriddenProvider: Provider,
provider: Provider,
- type: ResourceType
+ type: ResourceType,
) {
assumeTrue(defaultCost != overriddenCost)
assumeTrue(overriddenProvider != provider)
@@ -68,7 +68,7 @@ class TradingRulesTest {
overriddenProvider: Provider,
overriddenType: ResourceType,
provider: Provider,
- type: ResourceType
+ type: ResourceType,
) {
assumeTrue(overriddenProvider != provider || overriddenType != type)
val rules = TradingRules(defaultCost)
@@ -83,7 +83,7 @@ class TradingRulesTest {
overriddenCost: Int,
overriddenType: ResourceType,
provider: Provider,
- type: ResourceType
+ type: ResourceType,
) {
assumeTrue(overriddenType != type)
val rules = TradingRules(defaultCost)
@@ -98,7 +98,7 @@ class TradingRulesTest {
overriddenCost: Int,
overriddenProvider: Provider,
provider: Provider,
- type: ResourceType
+ type: ResourceType,
) {
assumeTrue(overriddenProvider != provider)
val rules = TradingRules(defaultCost)
@@ -106,7 +106,7 @@ class TradingRulesTest {
val boughtResources = createTransactions(
createTransaction(provider, type),
- createTransaction(overriddenProvider, type)
+ createTransaction(overriddenProvider, type),
)
assertEquals(defaultCost + overriddenCost, rules.computeCost(boughtResources))
diff --git a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/test/TestUtils.kt b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/test/TestUtils.kt
index 332718f9..a1b42b49 100644
--- a/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/test/TestUtils.kt
+++ b/sw-engine/src/test/kotlin/org/luxons/sevenwonders/engine/test/TestUtils.kt
@@ -22,14 +22,17 @@ import org.luxons.sevenwonders.model.Settings
import org.luxons.sevenwonders.model.boards.RelativeBoardPosition
import org.luxons.sevenwonders.model.cards.CardBack
import org.luxons.sevenwonders.model.cards.Color
-import org.luxons.sevenwonders.model.resources.*
+import org.luxons.sevenwonders.model.resources.CountedResource
+import org.luxons.sevenwonders.model.resources.Provider
+import org.luxons.sevenwonders.model.resources.ResourceTransaction
+import org.luxons.sevenwonders.model.resources.ResourceTransactions
+import org.luxons.sevenwonders.model.resources.ResourceType
+import org.luxons.sevenwonders.model.resources.noTransactions
internal const val SEED: Long = 42
-internal fun testSettings(initialGold: Int = 0): Settings = Settings(
- randomSeedForTests = SEED,
- initialGold = initialGold
-)
+internal fun testSettings(initialGold: Int = 0): Settings =
+ Settings(randomSeedForTests = SEED, initialGold = initialGold)
internal fun testTable(nbPlayers: Int = 5): Table = testTable(nbPlayers, testSettings())
@@ -40,7 +43,7 @@ private fun testBoards(count: Int, settings: Settings): List<Board> = List(count
internal fun testBoard(
initialResource: ResourceType = ResourceType.WOOD,
initialGold: Int = 0,
- vararg production: ResourceType
+ vararg production: ResourceType,
): Board {
val settings = testSettings(initialGold = initialGold)
val board = testBoard(settings, initialResource)
@@ -69,7 +72,8 @@ internal fun createTransactions(vararg transactions: ResourceTransaction): Resou
internal fun createTransaction(provider: Provider, vararg resources: ResourceType): ResourceTransaction =
ResourceTransaction(provider, resources.map { CountedResource(1, it) })
-internal fun createRequirements(vararg types: ResourceType): Requirements = Requirements(resources = resourcesOf(*types))
+internal fun createRequirements(vararg types: ResourceType): Requirements =
+ Requirements(resources = resourcesOf(*types))
internal fun sampleCards(nbCards: Int, fromIndex: Int = 0, color: Color = Color.BLUE): List<Card> =
List(nbCards) { i -> testCard("Test Card ${fromIndex + i}", color) }
@@ -83,7 +87,7 @@ internal fun testCard(
name: String = "Test Card",
color: Color = Color.BLUE,
requirements: Requirements = Requirements(),
- effect: Effect? = null
+ effect: Effect? = null,
): Card {
val effects = if (effect == null) emptyList() else listOf(effect)
return Card(name, color, requirements, effects, null, emptyList(), "path/to/card/image", CardBack("image-III"))
bgstack15