From 18cb1c86c94b3076569a37a8d37079a136e29ae4 Mon Sep 17 00:00:00 2001 From: Michael Walker Date: Thu, 31 Mar 2016 14:45:55 +0100 Subject: [PATCH] Organise tests a little --- dejafu-tests/Cases.hs | 15 +++++++++++++++ dejafu-tests/Examples.hs | 17 +++++++++++++++++ dejafu-tests/Main.hs | 31 ++++++++++--------------------- dejafu-tests/dejafu-tests.cabal | 4 +++- 4 files changed, 45 insertions(+), 22 deletions(-) create mode 100755 dejafu-tests/Cases.hs create mode 100755 dejafu-tests/Examples.hs diff --git a/dejafu-tests/Cases.hs b/dejafu-tests/Cases.hs new file mode 100755 index 0000000..b4394f4 --- /dev/null +++ b/dejafu-tests/Cases.hs @@ -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) + ] diff --git a/dejafu-tests/Examples.hs b/dejafu-tests/Examples.hs new file mode 100755 index 0000000..aaa9ddf --- /dev/null +++ b/dejafu-tests/Examples.hs @@ -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) + ] diff --git a/dejafu-tests/Main.hs b/dejafu-tests/Main.hs index 8adb654..d5a02b1 100755 --- a/dejafu-tests/Main.hs +++ b/dejafu-tests/Main.hs @@ -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) ] diff --git a/dejafu-tests/dejafu-tests.cabal b/dejafu-tests/dejafu-tests.cabal index a69a9c3..bc52610 100644 --- a/dejafu-tests/dejafu-tests.cabal +++ b/dejafu-tests/dejafu-tests.cabal @@ -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