Organise tests a little

This commit is contained in:
Michael Walker 2016-03-31 14:45:55 +01:00
parent 9e68038e2b
commit 18cb1c86c9
4 changed files with 45 additions and 22 deletions

15
dejafu-tests/Cases.hs Executable file
View File

@ -0,0 +1,15 @@
module Cases where
import Test.Framework (Test, testGroup)
import qualified Cases.SingleThreaded as S
import qualified Cases.MultiThreaded as M
import qualified Cases.Litmus as L
-- | Run all the test cases.
testCases :: [Test]
testCases = map (uncurry testGroup)
[ ("Single Threaded", S.tests)
, ("Multi Threaded", M.tests)
, ("Litmus", L.tests)
]

17
dejafu-tests/Examples.hs Executable file
View File

@ -0,0 +1,17 @@
module Examples where
import Test.Framework (Test, testGroup)
import qualified Examples.AutoUpdate as A
import qualified Examples.ClassLaws as C
import qualified Examples.Logger as L
import qualified Examples.Philosophers as P
-- | Run all the example tests.
testExamples :: [Test]
testExamples = map (uncurry testGroup)
[ ("auto-update", A.tests)
, ("Class Laws", C.tests)
, ("Dining Philosophers", P.tests)
, ("Message Logger", L.tests)
]

View File

@ -1,26 +1,15 @@
module Main (main) where
module Main where
import Test.Framework (defaultMain, testGroup)
import Test.Framework (Test, defaultMain, testGroup)
import qualified Cases.SingleThreaded as ST
import qualified Cases.MultiThreaded as MT
import qualified Cases.Litmus as L
import qualified Examples.AutoUpdate as EA
import qualified Examples.ClassLaws as EC
import qualified Examples.Logger as EL
import qualified Examples.Philosophers as EP
import Cases
import Examples
main :: IO ()
main = defaultMain
[ testGroup "Test Cases"
[ testGroup "Single Threaded" ST.tests
, testGroup "Multi Threaded" MT.tests
, testGroup "Litmus" L.tests
]
, testGroup "Examples"
[ testGroup "auto-update" EA.tests
, testGroup "Class Laws" EC.tests
, testGroup "Dining Philosophers" EP.tests
, testGroup "Message Logger" EL.tests
]
main = defaultMain allTests
allTests :: [Test]
allTests = map (uncurry testGroup)
[ ("Test Cases", testCases)
, ("Examples", testExamples)
]

View File

@ -19,10 +19,12 @@ cabal-version: >=1.10
executable dejafu-tests
main-is: Main.hs
other-modules: Cases.SingleThreaded
other-modules: Cases
, Cases.SingleThreaded
, Cases.MultiThreaded
, Cases.Litmus
, Examples
, Examples.AutoUpdate
, Examples.ClassLaws
, Examples.Logger