summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2016-12-20 00:08:42 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2016-12-20 10:35:14 +0000
commit4535fa2646fb0df753165ecbad25be53318ec123 (patch)
tree5157e939a0d98734d9949a51d7986470b5e2a36e
parent27f79255634d9789f367273504545c1ebfad90a0 (diff)
downloadhaskell-4535fa2646fb0df753165ecbad25be53318ec123.tar.gz
Test Trac #12996
-rw-r--r--testsuite/tests/perf/should_run/T12996.hs29
-rw-r--r--testsuite/tests/perf/should_run/T12996.stdout24
-rw-r--r--testsuite/tests/perf/should_run/all.T7
3 files changed, 60 insertions, 0 deletions
diff --git a/testsuite/tests/perf/should_run/T12996.hs b/testsuite/tests/perf/should_run/T12996.hs
new file mode 100644
index 0000000000..78e6264a1d
--- /dev/null
+++ b/testsuite/tests/perf/should_run/T12996.hs
@@ -0,0 +1,29 @@
+{-# OPTIONS_GHC -fno-full-laziness #-}
+
+module Main where
+
+import Control.Monad (unless)
+import Data.Time.Clock
+import System.IO
+
+data AppState = AppState [Int]
+
+cycleState :: [Int] -> [Int]
+cycleState w = filter (check w) w
+
+check :: [Int] -> Int -> Bool
+check world pos = pos `elem` world
+
+initialSet :: [Int]
+initialSet = [1]
+
+main :: IO ()
+main = appLoop 24 (AppState initialSet)
+
+appLoop :: Int -> AppState -> IO ()
+appLoop n s
+ | n == 0 = return ()
+ | otherwise = do let AppState state = s
+ print state
+ appLoop (n-1) $ AppState (cycleState state)
+
diff --git a/testsuite/tests/perf/should_run/T12996.stdout b/testsuite/tests/perf/should_run/T12996.stdout
new file mode 100644
index 0000000000..a0fb88567b
--- /dev/null
+++ b/testsuite/tests/perf/should_run/T12996.stdout
@@ -0,0 +1,24 @@
+[1]
+[1]
+[1]
+[1]
+[1]
+[1]
+[1]
+[1]
+[1]
+[1]
+[1]
+[1]
+[1]
+[1]
+[1]
+[1]
+[1]
+[1]
+[1]
+[1]
+[1]
+[1]
+[1]
+[1]
diff --git a/testsuite/tests/perf/should_run/all.T b/testsuite/tests/perf/should_run/all.T
index 5e7e5cfd67..424bdcb04f 100644
--- a/testsuite/tests/perf/should_run/all.T
+++ b/testsuite/tests/perf/should_run/all.T
@@ -445,3 +445,10 @@ test('T9339',
only_ways(['normal'])],
compile_and_run,
['-O2'])
+
+test('T12996',
+ [stats_num_field('bytes allocated',
+ [ (wordsize(64), 76776, 5) ]),
+ only_ways(['normal'])],
+ compile_and_run,
+ ['-O2'])