paramtree

Generate labelled test/benchmark trees from sets of parameters

https://github.com/merijn/paramtree

Stackage Nightly 2025-05-01:0.1.2@rev:1
Latest on Hackage:0.1.2@rev:1

See all snapshots paramtree appears in

BSD-3-Clause licensed by Merijn Verstraaten
Maintained by Merijn Verstraaten
This version can be pinned in stack with:paramtree-0.1.2@sha256:52b28d40a919b669c78e1d05eee19cbfc65ceb063226b75373f720bf15310d7d,2403

Module documentation for 0.1.2

Depends on 2 packages(full list with versions):

ParamTree

BSD3 Hackage hackage-ci Build Status

ParamTree library for generating labelled test/benchmark trees from sets of parameters. Example usecases include criterion benchmark trees or tasty test trees.

Example

import Test.Tasty
import Test.Tasty.HUnit

genTestCase :: Int -> Bool -> Char -> String -> TestTree
genTestCase i b c name = testCase name $ {- your code here -}

params = simpleParam "Int" [1,2]
       . simpleParam "Bool" [True]
       . simpleParam "Char" "xyz"

main :: IO ()
main = defaultMain $ testTree genTestCase params
  where
    testTree = growTree (Just "/") testGroup "my tests"

This generates a tasty TestTree with all combinations of values passed to genTestCase. If the Maybe String argument is provided like in the above example, groups with a single entry, such as “Bool” get collapsed into their parent groups. So instead of a “1 Int” group containing a “True Bool” group they get collapsed into a single “1 Int/True Bool” group, where the “/” separator is the one specified by Just "/".