Split the doctests out into a new file, Doctests.hs.
Integrate all tests with cabal.
+BIN = dist/build/spline3/spline3
+DOCTESTS_BIN = dist/build/doctests/doctests
+TESTSUITE_BIN = dist/build/testsuite/testsuite
+
.PHONY : test publish_doc doc src_html hlint
-spline3: src/*.hs
+$(BIN): src/*.hs
runghc Setup.hs clean
runghc Setup.hs configure --user --flags=${FLAGS}
runghc Setup.hs build
+$(DOCTESTS_BIN): src/*.hs test/Doctests.hs
+ runghc Setup.hs configure --user --flags=${FLAGS} --enable-tests
+ runghc Setup.hs build
+
+$(TESTSUITE_BIN): src/*.hs test/TestSuite.hs
+ runghc Setup.hs configure --user --flags=${FLAGS} --enable-tests
+ runghc Setup.hs build
+
llvm: src/*.hs
FLAGS="llvm" make
rm -f *.prof
rm -rf .hpc
-test:
- runghc -i"src" test/TestSuite.hs
+test: $(BIN) $(DOCTESTS_BIN) $(TESTSUITE_BIN)
+ runghc Setup.hs test
src_html:
util/hscolour_srcs
description: Build with LLVM
default: False
+
executable spline3
build-depends:
base == 4.5.*,
- doctest == 0.7.*,
filepath == 1.*,
- HUnit == 1.2.*,
- QuickCheck == 2.*,
repa == 3.2.*,
repa-algorithms == 3.2.*,
repa-io == 3.2.*,
+ vector == 0.9.*,
+ -- Additional test dependencies.
+ HUnit == 1.2.*,
+ QuickCheck == 2.*,
test-framework == 0.6.*,
- test-framework-doctest == 0.2.*,
test-framework-hunit == 0.2.*,
- test-framework-quickcheck2 == 0.2.*,
- vector == 0.9.*
+ test-framework-quickcheck2 == 0.2.*
main-is:
Main.hs
-prof
-auto-all
-caf-all
+
+
+test-suite doctests
+ type: exitcode-stdio-1.0
+ hs-source-dirs: test
+ main-is: Doctests.hs
+ build-depends:
+ base == 4.5.*,
+ -- Additional test dependencies.
+ doctest == 0.7.*
+
+ -- It's not entirely clear to me why I have to reproduce all of this.
+ ghc-options:
+ -rtsopts
+ -threaded
+ -funbox-strict-fields
+ -fexcess-precision
+ -fno-spec-constr-count
+
+ if flag(llvm)
+ ghc-options:
+ -fllvm
+ -optlo-O3
+ -optlc-O3
+ else
+ ghc-options:
+ -O2
+ -optc-O3
+ -optc-march=native
+
+
+test-suite testsuite
+ type: exitcode-stdio-1.0
+ hs-source-dirs: src test
+ main-is: TestSuite.hs
+ build-depends:
+ base == 4.5.*,
+ filepath == 1.*,
+ repa == 3.2.*,
+ repa-algorithms == 3.2.*,
+ repa-io == 3.2.*,
+ vector == 0.9.*,
+ -- Additional test dependencies.
+ HUnit == 1.2.*,
+ QuickCheck == 2.*,
+ test-framework == 0.6.*,
+ test-framework-hunit == 0.2.*,
+ test-framework-quickcheck2 == 0.2.*
+
+ -- It's not entirely clear to me why I have to reproduce all of this.
+ ghc-options:
+ -rtsopts
+ -threaded
+ -funbox-strict-fields
+ -fexcess-precision
+ -fno-spec-constr-count
+
+ if flag(llvm)
+ ghc-options:
+ -fllvm
+ -optlo-O3
+ -optlc-O3
+ else
+ ghc-options:
+ -O2
+ -optc-O3
+ -optc-march=native
+
+
+source-repository head
+ type: git
+ location: http://michael.orlitzky.com/git/spline3.git
+ branch: master
--- /dev/null
+module Main
+where
+
+import Test.DocTest
+
+main :: IO ()
+main = doctest ["--optghc=-isrc", "src/Everything.hs"]
-module TestSuite
+module Main
where
import Data.Monoid (mempty)
import Test.Framework.Options
import Test.Framework.Runners.Options
import Test.Framework.Providers.API (TestName)
-import Test.Framework.Providers.DocTest
import Test.Framework.Providers.HUnit (testCase)
import Test.Framework.Providers.QuickCheck2 (testProperty)
import Test.HUnit
main :: IO ()
main = do
- dt <- docTest ["src/Everything.hs"] ["-isrc"]
-
let empty_test_opts = mempty :: TestOptions
let my_test_opts = empty_test_opts {
topt_maximum_generated_tests = Just 500
ropt_test_options = Just my_test_opts
}
- defaultMainWithOpts ([dt] ++ tests) my_runner_opts
+ defaultMainWithOpts tests my_runner_opts
-- | Defined so that my test names fit on one line.