[commit: testsuite] wip/nested-cpr: Nested CPR example: Extended Euclidean algorithm (7a8bace)
git at git.haskell.org
git at git.haskell.org
Thu Dec 12 17:56:33 UTC 2013
Repository : ssh://git@git.haskell.org/testsuite
On branch : wip/nested-cpr
Link : http://ghc.haskell.org/trac/ghc/changeset/7a8bacec3a42b3b3f46911d8c22c1768a4fb0844/testsuite
>---------------------------------------------------------------
commit 7a8bacec3a42b3b3f46911d8c22c1768a4fb0844
Author: Joachim Breitner <mail at joachim-breitner.de>
Date: Tue Dec 10 11:51:55 2013 +0000
Nested CPR example: Extended Euclidean algorithm
>---------------------------------------------------------------
7a8bacec3a42b3b3f46911d8c22c1768a4fb0844
tests/stranal/sigs/ExtendedEu.hs | 10 ++++++++++
tests/stranal/sigs/{FacState.stderr => ExtendedEu.stderr} | 2 +-
tests/stranal/sigs/all.T | 1 +
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/tests/stranal/sigs/ExtendedEu.hs b/tests/stranal/sigs/ExtendedEu.hs
new file mode 100644
index 0000000..115a976
--- /dev/null
+++ b/tests/stranal/sigs/ExtendedEu.hs
@@ -0,0 +1,10 @@
+{-# LANGUAGE BangPatterns #-}
+
+module ExtendedEu where
+
+extendedEu :: Int -> Int -> (Int, Int)
+extendedEu a 0 = (1, 0)
+extendedEu a b = let b' = s - q * t
+ in b' `seq` (t, b')
+ where (q, r) = quotRem a b
+ (s, t) = extendedEu b r
diff --git a/tests/stranal/sigs/FacState.stderr b/tests/stranal/sigs/ExtendedEu.stderr
similarity index 51%
copy from tests/stranal/sigs/FacState.stderr
copy to tests/stranal/sigs/ExtendedEu.stderr
index 18a551d..f45ba12 100644
--- a/tests/stranal/sigs/FacState.stderr
+++ b/tests/stranal/sigs/ExtendedEu.stderr
@@ -1,5 +1,5 @@
==================== Strictness signatures ====================
-FacState.fac: <S,1*U(U)><L,U>dm(d,tm(d))
+ExtendedEu.extendedEu: <L,1*U(U)><S(S),1*U(U)>dm(tm(d),tm(d))
diff --git a/tests/stranal/sigs/all.T b/tests/stranal/sigs/all.T
index 3681fb7..84273a6 100644
--- a/tests/stranal/sigs/all.T
+++ b/tests/stranal/sigs/all.T
@@ -13,3 +13,4 @@ test('HyperStrUse', normal, compile, [''])
test('T8598', normal, compile, [''])
test('FacState', normal, compile, [''])
test('UnsatFun', normal, compile, [''])
+test('ExtendedEu', normal, compile, [''])
More information about the ghc-commits
mailing list