packages feed

chatter-0.5.1.0: tests/src/NLP/TypesTests.hs

module NLP.TypesTests where

import Test.QuickCheck.Instances ()
import Test.Tasty (TestTree, testGroup)
import Test.Tasty.QuickCheck (testProperty)

import Data.Serialize (decode, encode)
import NLP.Types (Corpus(..))


tests :: TestTree
tests = testGroup "NLP.Types"
        [ testGroup "Serialize / Deserialize Tests"
          [ testProperty "Corpus round-trips" prop_corpusSerialize
          ]
        ]

prop_corpusSerialize :: Corpus -> Bool
prop_corpusSerialize c = case (decode . encode) c of
                           Right c' -> c == c'
                           Left _ -> False