Safe Haskell | None |
---|
Unittests for ganeti-htools.
Synopsis
- genNonCommaString :: Gen String
- prop_commaJoinSplit :: Property
- prop_commaSplitJoin :: String -> Property
- prop_findFirst :: Property
- prop_fromObjWithDefault :: Integer -> String -> Bool
- prop_if'if :: Bool -> Int -> Int -> Property
- prop_select :: Int -> [Int] -> [Int] -> Property
- prop_select_undefd :: [Int] -> NonEmptyList Int -> Property
- prop_select_undefv :: [Int] -> NonEmptyList Int -> Property
- prop_parseUnit :: NonNegative Int -> Property
- case_niceSort_static :: Assertion
- prop_niceSort_single :: Property
- prop_niceSort_generic :: Property
- prop_niceSort_numbers :: Property
- prop_niceSortKey_equiv :: Property
- prop_rStripSpace :: NonEmptyList Char -> Property
- case_new_uuid :: Assertion
- case_new_uuid_regex :: Assertion
- prop_clockTimeToString :: Integer -> Integer -> Property
- prop_timediffAdd :: ClockTime -> ClockTime -> ClockTime -> Property
- prop_chompPrefix_normal :: String -> Property
- prop_chompPrefix_last :: Property
- prop_chompPrefix_empty_string :: Property
- prop_chompPrefix_nothing :: Property
- prop_trim :: NonEmptyList Char -> Property
- prop_splitRecombineEithers :: [Either Int Int] -> Property
- testUtils :: Test
Documentation
genNonCommaString :: Gen String Source #
Helper to generate a small string that doesn't contain commas.
prop_commaJoinSplit :: Property Source #
If the list is not just an empty element, and if the elements do not contain commas, then join+split should be idempotent.
prop_commaSplitJoin :: String -> Property Source #
Split and join should always be idempotent.
prop_findFirst :: Property Source #
Test findFirst
on several possible inputs.
prop_fromObjWithDefault :: Integer -> String -> Bool Source #
fromObjWithDefault, we test using the Maybe monad and an integer value.
prop_if'if :: Bool -> Int -> Int -> Property Source #
Test that functional if' behaves like the syntactic sugar if.
:: Int | Default result |
-> [Int] | List of False values |
-> [Int] | List of True values |
-> Property | Test result |
Test basic select functionality
:: [Int] | List of False values |
-> NonEmptyList Int | List of True values |
-> Property | Test result |
Test basic select functionality with undefined default
:: [Int] | List of False values |
-> NonEmptyList Int | List of True values |
-> Property | Test result |
Test basic select functionality with undefined list values
prop_parseUnit :: NonNegative Int -> Property Source #
case_niceSort_static :: Assertion Source #
prop_niceSort_single :: Property Source #
Tests single-string behaviour of niceSort
.
prop_niceSort_generic :: Property Source #
Tests some generic niceSort
properties. Note that the last test
must add a non-digit prefix; a digit one might change ordering.
prop_niceSort_numbers :: Property Source #
Tests that niceSorting numbers is identical to actual sorting them (in numeric form).
prop_niceSortKey_equiv :: Property Source #
Tests that niceSort
and niceSortKey
are equivalent.
prop_rStripSpace :: NonEmptyList Char -> Property Source #
Tests rStripSpace
.
case_new_uuid :: Assertion Source #
Tests that the newUUID function produces valid UUIDs.
case_new_uuid_regex :: Assertion Source #
Tests that the newUUID function produces valid UUIDs.
prop_clockTimeToString :: Integer -> Integer -> Property Source #
prop_timediffAdd :: ClockTime -> ClockTime -> ClockTime -> Property Source #
Verify our work-around for ghc bug #2519. Taking diffClockTimes
form
Time
, this test fails with an exception.
prop_chompPrefix_normal :: String -> Property Source #
Test normal operation for chompPrefix
.
Any random prefix of a string must be stripped correctly, including the empty prefix, and the whole string.
prop_chompPrefix_last :: Property Source #
Test that chompPrefix
correctly allows the last char (the separator) to
be absent if the string terminates there.
prop_chompPrefix_empty_string :: Property Source #
Test that chompPrefix on the empty string always returns Nothing for prefixes of length 2 or more.
prop_chompPrefix_nothing :: Property Source #
Test chompPrefix
returns Nothing when the prefix doesn't match.
prop_splitRecombineEithers :: [Either Int Int] -> Property Source #
Tests splitEithers
and recombineEithers
.