summaryrefslogtreecommitdiff
path: root/testsuite/tests/numeric
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-02-11 09:18:09 +0100
committerBen Gamari <ben@smart-cactus.org>2020-06-17 16:22:04 -0400
commitf817d816e60a487bca64037095c01e9956225b64 (patch)
tree7e2779c7e2485539001b3649bea62554b6d924f7 /testsuite/tests/numeric
parentaa9e7b7196f03f84579e3b4a09068c668cbe6ffb (diff)
downloadhaskell-f817d816e60a487bca64037095c01e9956225b64.tar.gz
Update testsuite
* support detection of slow ghc-bignum backend (to replace the detection of integer-simple use). There are still some test cases that the native backend doesn't handle efficiently enough. * remove tests for GMP only functions that have been removed from ghc-bignum * fix test results showing dependent packages (e.g. integer-gmp) or showing suggested instances * fix test using Integer/Natural API or showing internal names
Diffstat (limited to 'testsuite/tests/numeric')
-rw-r--r--testsuite/tests/numeric/should_compile/T14465.hs4
-rw-r--r--testsuite/tests/numeric/should_compile/T14465.stdout26
-rw-r--r--testsuite/tests/numeric/should_compile/all.T3
-rw-r--r--testsuite/tests/numeric/should_run/T15301.hs2
4 files changed, 17 insertions, 18 deletions
diff --git a/testsuite/tests/numeric/should_compile/T14465.hs b/testsuite/tests/numeric/should_compile/T14465.hs
index 314aa89c56..93a3b20020 100644
--- a/testsuite/tests/numeric/should_compile/T14465.hs
+++ b/testsuite/tests/numeric/should_compile/T14465.hs
@@ -4,7 +4,7 @@
module M where
import Numeric.Natural
-import GHC.Natural
+import GHC.Num.Natural
-- test Natural literals
one :: Natural
@@ -15,7 +15,7 @@ plusOne n = n + 1
-- a built-in rule should convert this unfolding into a Natural literal in Core
ten :: Natural
-ten = wordToNatural 10
+ten = naturalFromWord 10
-- test basic constant folding for Natural
twoTimesTwo :: Natural
diff --git a/testsuite/tests/numeric/should_compile/T14465.stdout b/testsuite/tests/numeric/should_compile/T14465.stdout
index 1eb5182a6c..579349af47 100644
--- a/testsuite/tests/numeric/should_compile/T14465.stdout
+++ b/testsuite/tests/numeric/should_compile/T14465.stdout
@@ -1,14 +1,14 @@
==================== Tidy Core ====================
Result size of Tidy Core
- = {terms: 39, types: 19, coercions: 0, joins: 0/0}
+ = {terms: 40, types: 17, coercions: 0, joins: 0/0}
--- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
+-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
ten :: Natural
[GblId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
- WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
-ten = 10
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
+ten = GHC.Num.Natural.NS 10##
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
M.$trModule4 :: GHC.Prim.Addr#
@@ -52,19 +52,19 @@ M.minusOne1 :: Natural
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}]
M.minusOne1 = 1
--- RHS size: {terms: 11, types: 6, coercions: 0, joins: 0/0}
+-- RHS size: {terms: 11, types: 4, coercions: 0, joins: 0/0}
minusOne :: Natural
[GblId,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False,
WorkFree=True, Expandable=False, Guidance=IF_ARGS [] 40 0}]
minusOne
- = case M.minusOne1 of {
- NatS# ds1 ->
+ = case M.minusOne1 of wild {
+ NS ds1 ->
case ds1 of {
- __DEFAULT -> GHC.Natural.underflowError @Natural;
- 0## -> GHC.Natural.zero
+ __DEFAULT -> GHC.Num.$fNumNatural1;
+ 0## -> wild
};
- NatJ# ipv -> GHC.Natural.underflowError @Natural
+ NB ipv -> GHC.Num.$fNumNatural1
}
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
@@ -78,12 +78,12 @@ twoTimesTwo = 4
plusOne :: Natural -> Natural
[GblId,
Arity=1,
- Str=<S,U>,
+ Str=<S,1*U>,
Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False)
- Tmpl= \ (n [Occ=Once] :: Natural) -> plusNatural n M.minusOne1}]
-plusOne = \ (n :: Natural) -> plusNatural n M.minusOne1
+ Tmpl= \ (n [Occ=Once] :: Natural) -> naturalAdd n M.minusOne1}]
+plusOne = \ (n :: Natural) -> naturalAdd n M.minusOne1
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
one :: Natural
diff --git a/testsuite/tests/numeric/should_compile/all.T b/testsuite/tests/numeric/should_compile/all.T
index a0ae051e81..7c39541e5b 100644
--- a/testsuite/tests/numeric/should_compile/all.T
+++ b/testsuite/tests/numeric/should_compile/all.T
@@ -1,7 +1,6 @@
test('T7116', normal, makefile_test, ['T7116'])
-# These test Core output that depends upon integer-gmp
test('T14170', normal, makefile_test, ['T14170'])
-test('T14465', reqlib("integer-gmp"), makefile_test, ['T14465'])
+test('T14465', normal, makefile_test, ['T14465'])
test('T7895', normal, compile, [''])
test('T7881', normal, compile, [''])
# For T8542, the hpc way adds extra annotations that prevent
diff --git a/testsuite/tests/numeric/should_run/T15301.hs b/testsuite/tests/numeric/should_run/T15301.hs
index 6efbce4334..def28ecf8c 100644
--- a/testsuite/tests/numeric/should_run/T15301.hs
+++ b/testsuite/tests/numeric/should_run/T15301.hs
@@ -1,5 +1,5 @@
import Numeric
-import GHC.Natural
+import GHC.Num.Natural
main = do
-- test that GHC correctly compiles big Natural literals