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 Cases
import qualified Cases.MultiThreaded as MT import Examples
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
main :: IO () main :: IO ()
main = defaultMain main = defaultMain allTests
[ testGroup "Test Cases"
[ testGroup "Single Threaded" ST.tests allTests :: [Test]
, testGroup "Multi Threaded" MT.tests allTests = map (uncurry testGroup)
, testGroup "Litmus" L.tests [ ("Test Cases", testCases)
] , ("Examples", testExamples)
, testGroup "Examples"
[ testGroup "auto-update" EA.tests
, testGroup "Class Laws" EC.tests
, testGroup "Dining Philosophers" EP.tests
, testGroup "Message Logger" EL.tests
]
] ]

View File

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