"Conversions and Constructors"
[ testGroup "PrintableText"
[ printableTextFromTest
, printableTextSingletonTest
]
, testGroup "NonEmptyList"
[ nonEmptyListFromTest
, nonEmptyListSingletonProperty
]
]
testGroup "fromText conversions"
[ testCase "Empty String" $
Nothing @=? PrintableText.fromText ""
, testCase "All whitespaces" $
Nothing @=? PrintableText.fromText " \t\r\n"
, testCase "Valid string" $
Just " this is valid" @=? PrintableText.unPrintableText <$> PrintableText.fromText " this is valid"
]
testGroup "singleton constructor"
[ testCase "Whitespace character" $
Nothing @=? PrintableText.singleton ' '
, testCase "Valid character" $
Just "f" @=? PrintableText.unPrintableText <$> PrintableText.singleton 'f'
]
testGroup "fromList conversions"
[ testCase "Empty List" $
Nothing @=? NonEmptyList.fromList ([] @Int)
, testCase "Single item" $
Just (5, []) @=? NonEmptyList.uncons <$> NonEmptyList.fromList [5]
, testCase "Several items" $
Just (5, [4,3]) @=? NonEmptyList.uncons <$> NonEmptyList.fromList [5,4,3]
]
testGroup "singleton property"
[ testProperty "[a] == toList $ singleton a" $
\num -> [num] == (NonEmptyList.toList . NonEmptyList.singleton @Int $ num)
]
defaultMain tests
testGroup