Skip to content

Commit

Permalink
Fix integer overflow test with Ints (#58)
Browse files Browse the repository at this point in the history
* Fix integer overflow test with Ints

* Update changelog

* Refactor to use checkEuclideanRingGen
  • Loading branch information
JordanMartinez authored Sep 27, 2021
1 parent df56594 commit b09ef8c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ New features:
Bugfixes:

Other improvements:
- Fix integer overflow error in test for Ints (#58 by @JordanMartinez)

## [v6.0.1](https://github.com/purescript-contrib/purescript-quickcheck-laws/releases/tag/v6.0.1) - 2021-05-06

Expand Down
5 changes: 4 additions & 1 deletion test/Test/Prim/Int.purs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module Test.Prim.Int where
import Prelude

import Effect (Effect)
import Test.QuickCheck.Gen (chooseInt)
import Test.QuickCheck.Laws (checkLaws)
import Test.QuickCheck.Laws.Data as Data
import Type.Proxy (Proxy(..))
Expand All @@ -13,7 +14,9 @@ checkInt = checkLaws "Int" do
Data.checkOrd prxInt
Data.checkCommutativeRing prxInt
Data.checkSemiring prxInt
Data.checkEuclideanRing prxInt
-- Necessary for the EuclideanRing test
-- so as to prevent integer overflow when multiplying large integer values
Data.checkEuclideanRingGen (chooseInt (-10_000) 10_000)
Data.checkRing prxInt
where
prxInt = ProxyProxy Int

0 comments on commit b09ef8c

Please sign in to comment.