mirror of
https://github.com/Jaxan/ons-hs.git
synced 2025-04-27 14:47:45 +02:00
26 lines
691 B
Haskell
26 lines
691 B
Haskell
{-# OPTIONS_GHC -Wno-orphans #-}
|
|
|
|
module SpecPermutable (permutableTests) where
|
|
|
|
import Test.Tasty
|
|
import Test.Tasty.HUnit hiding (assert)
|
|
|
|
import Nominal
|
|
import Permutable
|
|
import SpecUtils
|
|
|
|
permutableTests :: TestTree
|
|
permutableTests = testGroup "Permutable" [assocTest n | n <- [0 .. 6]]
|
|
|
|
-- For n = 7, this takes roughly 30 seconds!
|
|
assocTest :: Int -> TestTree
|
|
assocTest n =
|
|
testCase ("associativity " <> show n) $
|
|
assert and $
|
|
[lhs f g == rhs f g | f <- perms, g <- perms]
|
|
where
|
|
element = fmap atom $ [1 .. n]
|
|
supp = support element
|
|
perms = allPermutations supp
|
|
lhs f g = act (Permuted (compose f g) element)
|
|
rhs f g = act (Permuted f (act (Permuted g element)))
|