{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE OverloadedLists #-}
module Data.Array.Accelerate.Test.NoFib.Issues.Issue407 (
test_issue407
) where
import Data.Proxy
import Data.Typeable
import Prelude as P
import Data.Array.Accelerate as A
import Data.Array.Accelerate.Test.NoFib.Base
import Test.Tasty
import Test.Tasty.HUnit
test_issue407 :: RunN -> TestTree
test_issue407 runN =
testGroup "407"
[ testElt (Proxy::Proxy Float)
, testElt (Proxy::Proxy Double)
]
where
testElt
:: forall a. (P.Fractional a, A.RealFloat a)
=> Proxy a
-> TestTree
testElt _ =
testGroup (show (typeOf (undefined :: a)))
[ testCase "isNaN" $ eNaN @=? runN (A.map A.isNaN) xs
, testCase "isInfinite" $ eInf @=? runN (A.map A.isInfinite) xs
]
where
xs :: Vector a
xs = [0/0, -2/0, -0/0, 0.1, 1/0, 0.5, 5/0]
eNaN = [True, False, True, False, False, False, False]
eInf = [False, True, False, False, True, False, True]