[commit: ghc] master: testsuite: Add test for floating-point abs (numrun015) (10d28d0)

git at git.haskell.org git at git.haskell.org
Fri Mar 3 21:36:06 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/10d28d0ababe52a705c10d450869d7a61063c4ae/ghc

>---------------------------------------------------------------

commit 10d28d0ababe52a705c10d450869d7a61063c4ae
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Fri Mar 3 15:49:14 2017 -0500

    testsuite: Add test for floating-point abs (numrun015)
    
    Test Plan: Validate
    
    Reviewers: idontgetoutmuch, austin
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D3273


>---------------------------------------------------------------

10d28d0ababe52a705c10d450869d7a61063c4ae
 testsuite/tests/numeric/should_run/all.T             |  1 +
 testsuite/tests/numeric/should_run/numrun015.hs      | 20 ++++++++++++++++++++
 .../tests/numeric/should_run/numrun015.stdout        |  4 ++++
 3 files changed, 25 insertions(+)

diff --git a/testsuite/tests/numeric/should_run/all.T b/testsuite/tests/numeric/should_run/all.T
index 6510dc9..2d2353b 100644
--- a/testsuite/tests/numeric/should_run/all.T
+++ b/testsuite/tests/numeric/should_run/all.T
@@ -33,6 +33,7 @@ test('numrun011', normal, compile_and_run, [''])
 test('numrun012', normal, compile_and_run, [''])
 test('numrun013', normal, compile_and_run, [''])
 test('numrun014', normal, compile_and_run, [''])
+test('numrun015', normal, compile_and_run, [''])
 test('arith016', normal, compile_and_run, [''])
 test('arith017', normal, compile_and_run, [''])
 test('arith018', normal, compile_and_run, [''])
diff --git a/testsuite/tests/numeric/should_run/numrun015.hs b/testsuite/tests/numeric/should_run/numrun015.hs
new file mode 100644
index 0000000..070c5ab
--- /dev/null
+++ b/testsuite/tests/numeric/should_run/numrun015.hs
@@ -0,0 +1,20 @@
+-- Test that floating-point abs works correctly
+
+absF :: Float -> Float
+absF = abs
+
+absD :: Double -> Double
+absD = abs
+
+main :: IO ()
+main = do
+    print $ absF (1 / 0)
+    print $ absD (1 / 0)
+    print $ absF 1
+    print $ absD 1
+    print $ absF (-1)
+    print $ absD (-1)
+    print $ absF (-1 / 0)
+    print $ absD (-1 / 0)
+    print $ absF (1 / 0)
+    print $ absD (1 / 0)
diff --git a/libraries/base/tests/T7034.stdout b/testsuite/tests/numeric/should_run/numrun015.stdout
similarity index 77%
copy from libraries/base/tests/T7034.stdout
copy to testsuite/tests/numeric/should_run/numrun015.stdout
index 2675153..33cdeb4 100644
--- a/libraries/base/tests/T7034.stdout
+++ b/testsuite/tests/numeric/should_run/numrun015.stdout
@@ -1,5 +1,9 @@
 Infinity
 Infinity
+1.0
+1.0
+1.0
+1.0
 Infinity
 Infinity
 Infinity



More information about the ghc-commits mailing list