Skip to content

Commit

Permalink
Fix more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Janiczek committed Oct 6, 2024
1 parent 470bced commit 8b29d89
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/LogicTest.elm
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,18 @@ test =
{ args
| attackStyle = AttackStyle.MeleeUnaimed
, equippedWeapon = Just weapon
, distanceHexes = args.distanceHexes + 1
, distanceHexes = args.distanceHexes + 2
}
|> Expect.equal 0
, Test.fuzz2 chanceToHitArgsFuzzer TestHelpers.gunKindFuzzer "Ranged + good range: can hit" <|
, Test.fuzz2 chanceToHitArgsFuzzer TestHelpers.smallGunKindFuzzer "Ranged + good range: can hit" <|
\args weapon ->
Logic.chanceToHit
{ args
| attackStyle = AttackStyle.ShootSingleUnaimed
, attackerSpecial = args.attackerSpecial |> Special.set Special.Strength 10
, attackerAddedSkillPercentages =
args.attackerAddedSkillPercentages
|> SeqDict.insert SmallGuns 20
, equippedWeapon = Just weapon
, distanceHexes = 1
, targetArmorClass = 0
Expand Down
8 changes: 8 additions & 0 deletions tests/TestHelpers.elm
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module TestHelpers exposing
, randomSeedFuzzer
, removeNewlinesAtEnds
, sequenceFuzzer
, smallGunKindFuzzer
, specialFuzzer
, traitsFuzzer
, unarmedWeaponKindFuzzer
Expand Down Expand Up @@ -448,6 +449,13 @@ gunKindFuzzer =
|> Fuzz.oneOfValues


smallGunKindFuzzer : Fuzzer Item.Kind
smallGunKindFuzzer =
Item.all
|> List.filter (\kind -> List.member Item.SmallGun (Item.types kind))
|> Fuzz.oneOfValues


ammoKindFuzzer : Fuzzer Item.Kind
ammoKindFuzzer =
Item.all
Expand Down

0 comments on commit 8b29d89

Please sign in to comment.