unagi-chan-0.2.0.0: tests/Main.hs
module Main
where
import System.IO
import Control.Concurrent
import Control.Exception
-- implementation-agnostic tests:
import Deadlocks
import Smoke
import DupChan
-- implementation-specific tests:
import Unagi
import UnagiUnboxed
import UnagiBounded
-- Other
import Atomics
import IndexedMVar
main :: IO ()
main = do
-- Make sure testing environment is sane:
assertionsWorking <- try $ assert False $ return ()
case assertionsWorking of
Left (AssertionFailed _) -> putStrLn "Assertions: On"
_ -> error "Assertions aren't working"
procs <- getNumCapabilities
if procs < 2
then error "Tests are only effective if more than 1 core is available"
else return ()
hSetBuffering stdout NoBuffering
-- -----------------------------------
-- test important properties of our atomic-primops:
atomicsMain
indexedMVarMain
-- do things catch fire?
smokeMain
-- dupChan tests
dupChanMain
-- check for deadlocks:
deadlocksMain
-- implementation-specific tests
unagiMain
unagiUnboxedMain
unagiBoundedMain
putStrLn "ALL DONE!"