[commit: ghc] master: testsuite: Add test for negative sqrts (#10010) (5161609)

git at git.haskell.org git at git.haskell.org
Tue Apr 10 15:36:15 UTC 2018


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/5161609117c16cb7b29b2b8b1cd41e74341d4137/ghc

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

commit 5161609117c16cb7b29b2b8b1cd41e74341d4137
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Sat Apr 7 13:31:42 2018 -0400

    testsuite: Add test for negative sqrts (#10010)
    
    Reviewers: hvr, alpmestan
    
    Reviewed By: alpmestan
    
    Subscribers: thomie, carter
    
    GHC Trac Issues: #10010
    
    Differential Revision: https://phabricator.haskell.org/D4543


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

5161609117c16cb7b29b2b8b1cd41e74341d4137
 libraries/base/tests/Numeric/all.T       | 1 +
 libraries/base/tests/Numeric/sqrt.hs     | 3 +++
 libraries/base/tests/Numeric/sqrt.stdout | 2 ++
 3 files changed, 6 insertions(+)

diff --git a/libraries/base/tests/Numeric/all.T b/libraries/base/tests/Numeric/all.T
index a0a9d68..0d7467e 100644
--- a/libraries/base/tests/Numeric/all.T
+++ b/libraries/base/tests/Numeric/all.T
@@ -25,3 +25,4 @@ test('num010',
      when(platform('i386-apple-darwin'), expect_broken_for(7043, 'ghci')),
      compile_and_run,
      [''])
+test('sqrt', normal, compile_and_run, [''])
diff --git a/libraries/base/tests/Numeric/sqrt.hs b/libraries/base/tests/Numeric/sqrt.hs
new file mode 100644
index 0000000..a58875a
--- /dev/null
+++ b/libraries/base/tests/Numeric/sqrt.hs
@@ -0,0 +1,3 @@
+main = do
+    print (sqrt (-7 :: Double))
+    print (sqrt (-7 :: Float))
diff --git a/libraries/base/tests/Numeric/sqrt.stdout b/libraries/base/tests/Numeric/sqrt.stdout
new file mode 100644
index 0000000..913b330
--- /dev/null
+++ b/libraries/base/tests/Numeric/sqrt.stdout
@@ -0,0 +1,2 @@
+NaN
+NaN



More information about the ghc-commits mailing list