{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE RankNTypes #-}
module Data.Array.Accelerate.Test.NoFib.Issues.Issue187 (
test_issue187
) where
import Data.Array.Accelerate as A
import Data.Array.Accelerate.Test.NoFib.Base
import Test.Tasty
import Test.Tasty.HUnit
test_issue187 :: RunN -> TestTree
test_issue187 runN =
testGroup "187"
[ testCase "A" $ ref1 @=? runN test1
, testCase "B" $ ref2 @=? runN test2
]
ref1 :: Scalar Bool
ref1 = fromList Z [True]
test1 :: Acc (Scalar Bool)
test1 =
let x = constant 1 :: Exp Int
v = use (fromList (Z :. 5) [1,2,3,4,5] :: Vector Int)
y = (x == 1 || v A.!! (-1) == 1)
in generate (constant Z) (const y)
ref2 :: Scalar Bool
ref2 = fromList Z [True]
test2 :: Acc (Scalar Bool)
test2 =
let x = constant 1 :: Exp Int
x' = unit x
v = use (fromList (Z :. 5) [1,2,3,4,5] :: Vector Int)
y = (x == the x' || let y' = v A.!! (-1) in y'*y' == 1)
in generate (constant Z) (const y)