File: AutoUpdateSpec.hs

package info (click to toggle)
haskell-auto-update 0.2.6-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 144 kB
  • sloc: haskell: 677; makefile: 2
file content (37 lines) | stat: -rw-r--r-- 956 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
module Control.AutoUpdateSpec (spec) where

-- import Control.AutoUpdate
-- import Control.Concurrent (threadDelay)
-- import Control.Monad (replicateM_, forM_)
-- import Data.IORef
import Test.Hspec

-- import Test.Hspec.QuickCheck

spec :: Spec
spec = return ()

-- do
--   prop "incrementer" $ \st' -> do
--       let st = abs st' `mod` 10000
--       ref <- newIORef 0
--       next <- mkAutoUpdate defaultUpdateSettings
--           { updateAction = atomicModifyIORef ref $ \i ->
--               let i' = succ i in i' `seq` (i', i')
--           , updateSpawnThreshold = st
--           , updateFreq = 10000
--           }

--       forM_ [1..st + 1] $ \i -> do
--           j <- next
--           j `shouldBe` i

--       replicateM_ 50 $ do
--           i <- next
--           i `shouldBe` st + 2

--       threadDelay 60000
--       last1 <- readIORef ref
--       threadDelay 20000
--       last2 <- readIORef ref
--       last2 `shouldBe` last1