Numeric underscores in tests

This commit is contained in:
Maciej Bendkowski 2022-03-27 12:58:31 +02:00
parent 79216f69b5
commit 66feb60074
3 changed files with 6 additions and 5 deletions

View File

@ -176,7 +176,7 @@ test-suite generic-boltzmann-brain-test
hs-source-dirs:
test
default-extensions:
LambdaCase BangPatterns DerivingVia FlexibleInstances UndecidableInstances TypeApplications ScopedTypeVariables Rank2Types
NumericUnderscores LambdaCase BangPatterns DerivingVia FlexibleInstances UndecidableInstances TypeApplications ScopedTypeVariables Rank2Types
ghc-options: -O2 -Wall -Wcompat -Wmissing-export-lists -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -Wno-name-shadowing -fwarn-missing-signatures
build-depends:
QuickCheck >=2.14.2

View File

@ -185,6 +185,7 @@ tests:
- tasty-quickcheck >= 0.10.0
- QuickCheck >= 2.14.2
default-extensions:
NumericUnderscores
LambdaCase
BangPatterns
DerivingVia

View File

@ -26,21 +26,21 @@ choiceTests =
testGroup
"Choice unit tests"
[ testCase "[1/2, 1/2] is correctly sampled from" $ do
[(0, a), (1, b)] <- choiceTest distributionA 1000000
[(0, a), (1, b)] <- choiceTest distributionA 1_000_000
a `almostEqual` 0.5
b `almostEqual` 0.5
, testCase "[1/3, 1/3, 1/3] is correctly sampled from" $ do
[(0, a), (1, b), (2, c)] <- choiceTest distributionB 1000000
[(0, a), (1, b), (2, c)] <- choiceTest distributionB 1_000_000
a `almostEqual` 0.33
b `almostEqual` 0.33
c `almostEqual` 0.33
, testCase "[1/7, 4/7, 2/7] is correctly sampled from" $ do
[(0, a), (1, b), (2, c)] <- choiceTest distributionC 1000000
[(0, a), (1, b), (2, c)] <- choiceTest distributionC 1_000_000
a `almostEqual` 0.14
b `almostEqual` 0.57
c `almostEqual` 0.28
, testCase "[1/1] is correctly sampled from" $ do
[(0, a)] <- choiceTest distributionD 1000000
[(0, a)] <- choiceTest distributionD 1_000_000
a `almostEqual` 1.0
]