This repository has been archived by the owner. It is now read-only.
Stub project showing how to organize tests and benchmarks in Haskell
Haskell
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bench
src
tests
.gitignore
LICENSE
README.md
Setup.hs
haskell-testing-stub.cabal

README.md

haskell-testing-stub

IMPORTANT: This repository is now hosted on BitBucket.

This stub project demonstrates how to organize code tests and benchmarks in a Haskell project. It shows how to:

  • separate tests and benchmarks from the actual code, so that users don't need to install testing and benchmarking libraries
  • use cabal to automate testing and benchmarking
  • use tasty to create a coherent test suite containing both HUnit and QuickCheck tests
  • create QuickCheck tests that run with many different test data sets.
  • use criterion to create benchmarks

Visit my blog for a detailed discussion of code testing and benchmarking in Haskell. See also comments in the source code.

Running tests

Execute these commands to compile and run tests:

cabal configure --enable-tests
cabal build
cabal test

Running benchmarks

Execute these commands to compile and run benchmarks:

cabal configure --enable-benchmarks
cabal build
cabal bench

Compiling the library

Execute these commands to install the library without benchmarking and testing code:

cabal configure
cabal build
cabal install