packages feed

kempe-0.2.0.2: test/Golden.hs

module Main (main) where

import           Data.Tuple.Extra (uncurry3)
import           Harness
import           System.Info      (arch)
import           Test.Tasty

main :: IO ()
main = defaultMain $
    testGroup "Golden output tests" $
        fmap (uncurry3 goldenOutput) allGoldens ++ crossTests

-- These are redundant on arm
crossTests :: [TestTree]
crossTests = case arch of
    "x86_64"  -> fmap (uncurry3 crossGolden) allGoldens
    "aarch64" -> []
    _         -> error "Test suite must be run on x86_64 or aarch64"

allGoldens :: [(FilePath, FilePath, FilePath)]
allGoldens =
    [ ("examples/factorial.kmp", "test/harness/factorial.c", "test/golden/factorial.out")
    , ("test/examples/splitmix.kmp", "test/harness/splitmix.c", "test/golden/splitmix.out")
    , ("lib/numbertheory.kmp", "test/harness/numbertheory.c", "test/golden/numbertheory.out")
    , ("test/examples/hamming.kmp", "test/harness/hamming.c", "test/golden/hamming.out")
    , ("test/examples/bool.kmp", "test/harness/bool.c", "test/golden/bool.out")
    , ("test/examples/const.kmp", "test/harness/const.c", "test/golden/const.out")
    ]