-
-
Notifications
You must be signed in to change notification settings - Fork 846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[#26] Property tests: rewind & duplicate #331
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you know why your PR is still not approved? Because I chose not to approve it. But they will.
xGen <- forAll $ Gen.int (Range.linear (-200) 200) | ||
digit <- forAll $ Gen.int (Range.linear 1 9) | ||
let x = if xGen `rem` 10 == 0 then xGen + digit else xGen | ||
(firstDigit x :: Int) === (lastDigit (reverseInt x) :: Int) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warning: Redundant do
it "last digit is the first digit of the reversed number" $
hedgehog $
do xGen <- forAll $ Gen.int (Range.linear (-200) 200)
digit <- forAll $ Gen.int (Range.linear 1 9)
let x = if xGen `rem` 10 == 0 then xGen + digit else xGen
(firstDigit x :: Int) === (lastDigit (reverseInt x) :: Int)
describe "Task6: duplicate property" $ do | ||
it "length (duplicate xs) = 2 * length xs" $ hedgehog $ do | ||
xs <- forAll $ Gen.list (Range.linear 0 10) Gen.bool | ||
length (duplicate xs) === 2 * length xs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warning: Redundant do
it "length (duplicate xs) = 2 * length xs" $
hedgehog $
do xs <- forAll $ Gen.list (Range.linear 0 10) Gen.bool
length (duplicate xs) === 2 * length xs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice properties and extra tests! 👍🏻
Part of #26