-- | Shared utilities for testing {-# LANGUAGE Rank2Types, GADTs, TypeFamilies #-} module Tests.Common where -------------------------------------------------------------------------------- import Math.Combinat.Classes import Math.Combinat.Partitions.Integer import Math.Combinat.Partitions.Set import Math.RootLoci.Algebra import Math.RootLoci.Misc import Test.Tasty.HUnit -------------------------------------------------------------------------------- forList :: [a] -> String -> (a -> Bool) -> Assertion forList xs msg check = assertBool msg $ and [ check x | x <- xs ] forAllInt :: Int -> String -> (Int -> Bool) -> Assertion forAllInt maxn msg check = assertBool msg $ and [ check i | i<-[0..maxn] ] forAllPart :: Int -> String -> (Partition -> Bool) -> Assertion forAllPart maxn msg check = assertBool msg $ and [ check p | p <- allPartitions maxn ] forAllPartPos :: Int -> String -> (Partition -> Bool) -> Assertion forAllPartPos maxn msg check = assertBool msg $ and [ check p | p <- allPartitions maxn , not (isEmpty p) ] forAllSetp :: Int -> String -> (SetPartition -> Bool) -> Assertion forAllSetp maxn msg check = assertBool msg $ and [ check p | k<-[0..maxn] , p <- setPartitions k ] --------------------------------------------------------------------------------