Skip to content

Commit

Permalink
feat(#326): fix tests inside atlas-unified-tests, add it to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
sourabhxyz committed Aug 25, 2024
1 parent ffc995c commit b1ca12b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ jobs:
run: cabal install --package-env=$(pwd) --overwrite-policy=always cardano-cli cardano-node
- name: Run privnet tests
run: cabal run atlas-privnet-tests -- -j1 --hide-successes
- name: Run unified tests
run: cabal run atlas-unified-tests -- -j1 --hide-successes
- name: Run all tests (cabal)
run: cabal run atlas-tests -- -j1 --hide-successes
- name: Run doctest (docspec)
Expand Down
5 changes: 3 additions & 2 deletions tests-unified/GeniusYield/Test/Unified/BetRef/PlaceBet.hs
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,14 @@ multipleBetsTraceCore brp refScript walletBets ws@Wallets{..} = do
asUser w1 $ verify (zip3 balanceDiffWithoutFees balanceBeforeAllTheseOps balanceAfterAllTheseOps)
where
-- | Function to verify that the wallet indeed lost by /roughly/ the bet amount.
-- We say /roughly/ as fees is assumed to be within (0, 1 ada].
-- We say /roughly/ as fees is assumed to be within (0, 1.5 ada].
-- Suppose that wallet x places bet 3 times, where for simplicity assume each tx costed 0.6 ada as fees then the threshold should be above 1.8 ada.
verify [] = return ()
verify (((wallet, diff), vBefore, vAfter) : xs) =
let vAfterWithoutFees = vBefore <> diff
(expectedAdaWithoutFees, expectedOtherAssets) = valueSplitAda vAfterWithoutFees
(actualAda, actualOtherAssets) = valueSplitAda vAfter
threshold = 1_000_000 -- 1 ada
threshold = 1_500_000 -- 1.5 ada
in
if expectedOtherAssets == actualOtherAssets
&& actualAda < expectedAdaWithoutFees
Expand Down

0 comments on commit b1ca12b

Please sign in to comment.