Commit d3f1cfdf authored by Yiannis Tsiouris's avatar Yiannis Tsiouris

Use Test.Framework with HUnit for tests

parent a94c0e8b
...@@ -2,3 +2,5 @@ ...@@ -2,3 +2,5 @@
*~ *~
*.o *.o
*.hi *.hi
orbit
OrbitTests
...@@ -3,8 +3,12 @@ ...@@ -3,8 +3,12 @@
orbit: FORCE orbit: FORCE
ghc --make Bench.hs -o orbit ghc --make Bench.hs -o orbit
tests: orbit
ghc -package test-framework -package test-framework-hunit \
-threaded Tests.hs -o OrbitTests
clean: clean:
$(RM) *.swp *~ *.hi *.o $(RM) *.swp *~ *.hi *.o
distclean: clean distclean: clean
$(RM) orbit $(RM) orbit OrbitTests
import Test.HUnit import Test.HUnit
import Test.Framework (defaultMain, testGroup)
import Test.Framework.Providers.HUnit
import Bench (seq, g13, g124, g1245) import Bench (seq, g13, g124, g1245)
test1 = TestCase (assertEqual "g13 11" "{size,10}" (Bench.seq g13 11)) main = defaultMain tests
test2 = TestCase (assertEqual "g124 157" "{size,133}" (Bench.seq g124 157))
test3 = TestCase (assertEqual "g1245 157" "{size,134}" (Bench.seq g1245 157))
tests = TestList [ TestLabel "seq short" test1 tests = [ testGroup "Sequential tests" [
, TestLabel "seq medium" test2 testCase "short" test1,
, TestLabel "seq long" test3 testCase "intermediate" test2,
testCase "long" test3
] ]
]
test1 = assertEqual "g13 11" "{size,10}" (Bench.seq g13 11)
test2 = assertEqual "g124 157" "{size,133}" (Bench.seq g124 157)
test3 = assertEqual "g1245 157" "{size,134}" (Bench.seq g1245 157)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment