module Main (main) where import Test.Tasty (TestTree, defaultMain, testGroup) import qualified Test.Tasty.QuickCheck as QC import Test.Tasty.HUnit (testCase, (@?=)) import Proquint main :: IO () main = defaultMain $ testGroup "tests" [roundtrip, valid, invalid] roundtrip :: TestTree roundtrip = QC.testProperty "roundtrip" $ \w -> proquintToWord16 (word16ToProquint w) == Just w valid :: TestTree valid = testCase "valid string" $ proquintToWord16 "pipog" @?= Just 42659 invalid :: TestTree invalid = testGroup "invalid strings" [ testCase "empty string" $ proquintToWord16 "" @?= Nothing , testCase "string longer than 5" $ proquintToWord16 "bababab" @?= Nothing , testCase "characters outside of range" $ proquintToWord16 "_____" @?= Nothing , testCase "unused characters" $ proquintToWord16 "cecec" @?= Nothing ]