diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2017-03-03 15:49:14 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-03-03 15:49:15 -0500 |
commit | 10d28d0ababe52a705c10d450869d7a61063c4ae (patch) | |
tree | d13a9cb96556b516ced7ca6ac301e54798972dc0 | |
parent | c1dacb8a9c18677495bbe7e41391f8ca7a573070 (diff) | |
download | haskell-10d28d0ababe52a705c10d450869d7a61063c4ae.tar.gz |
testsuite: Add test for floating-point abs (numrun015)
Test Plan: Validate
Reviewers: idontgetoutmuch, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D3273
-rw-r--r-- | testsuite/tests/numeric/should_run/all.T | 1 | ||||
-rw-r--r-- | testsuite/tests/numeric/should_run/numrun015.hs | 20 | ||||
-rw-r--r-- | testsuite/tests/numeric/should_run/numrun015.stdout | 10 |
3 files changed, 31 insertions, 0 deletions
diff --git a/testsuite/tests/numeric/should_run/all.T b/testsuite/tests/numeric/should_run/all.T index 6510dc91cd..2d2353bd8a 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 0000000000..070c5ab5bd --- /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/testsuite/tests/numeric/should_run/numrun015.stdout b/testsuite/tests/numeric/should_run/numrun015.stdout new file mode 100644 index 0000000000..33cdeb42bb --- /dev/null +++ b/testsuite/tests/numeric/should_run/numrun015.stdout @@ -0,0 +1,10 @@ +Infinity +Infinity +1.0 +1.0 +1.0 +1.0 +Infinity +Infinity +Infinity +Infinity |