From 1864d3527a5bb1b8e5ea59fc004026e050283f38 Mon Sep 17 00:00:00 2001 From: "Trevor L. McDonell" Date: Sun, 7 Sep 2014 16:55:23 +0200 Subject: [PATCH] nofib: add test for AccelerateHS/accelerate#123 --- accelerate-examples.cabal | 1 + examples/nofib/Test/Issues.hs | 2 ++ examples/nofib/Test/Issues/Issue123.hs | 29 ++++++++++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 examples/nofib/Test/Issues/Issue123.hs diff --git a/accelerate-examples.cabal b/accelerate-examples.cabal index 9b949e7..9bd2271 100644 --- a/accelerate-examples.cabal +++ b/accelerate-examples.cabal @@ -100,6 +100,7 @@ Executable accelerate-nofib Test.Issues.Issue93 Test.Issues.Issue102 Test.Issues.Issue114 + Test.Issues.Issue123 Test.Issues.Issue137 Test.Issues.Issue168 Test.Issues.Issue184 diff --git a/examples/nofib/Test/Issues.hs b/examples/nofib/Test/Issues.hs index 6c3ab9d..c8b0859 100644 --- a/examples/nofib/Test/Issues.hs +++ b/examples/nofib/Test/Issues.hs @@ -11,6 +11,7 @@ import Test.Framework import Test.Issues.Issue93 import Test.Issues.Issue102 import Test.Issues.Issue114 +import Test.Issues.Issue123 import Test.Issues.Issue137 import Test.Issues.Issue168 import Test.Issues.Issue184 @@ -25,6 +26,7 @@ test_issues conf = test_issue93 conf , test_issue102 conf , test_issue114 conf + , test_issue123 conf , test_issue137 conf , test_issue168 conf , test_issue184 conf diff --git a/examples/nofib/Test/Issues/Issue123.hs b/examples/nofib/Test/Issues/Issue123.hs new file mode 100644 index 0000000..90208fb --- /dev/null +++ b/examples/nofib/Test/Issues/Issue123.hs @@ -0,0 +1,29 @@ + +module Test.Issues.Issue123 (test_issue123) + where + +import Config +import ParseArgs +import Test.Base +import Test.Framework +import Test.Framework.Providers.HUnit + +import Prelude as P +import Data.Array.Accelerate as A +import Data.Label + + +test_issue123 :: Config -> Test +test_issue123 conf = + testCase "123" (assertEqual ref1 $ run backend (test1 n)) + where + backend = get configBackend conf + n = 100 + ref1 = fromList Z [n] + + +test1 :: Int -> Acc (Scalar Int) +test1 n + = fold (+) 0 + $ fill (constant (Z:.n)) 1 +