ganeti
Safe HaskellNone

Test.Ganeti.Utils

Description

Unittests for ganeti-htools.

Synopsis

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.

prop_select Source #

Arguments

:: Int

Default result

-> [Int]

List of False values

-> [Int]

List of True values

-> Property

Test result

Test basic select functionality

prop_select_undefd Source #

Arguments

:: [Int]

List of False values

-> NonEmptyList Int

List of True values

-> Property

Test result

Test basic select functionality with undefined default

prop_select_undefv Source #

Arguments

:: [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 #

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 #

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_trim :: NonEmptyList Char -> Property Source #

Tests trim.

prop_splitRecombineEithers :: [Either Int Int] -> Property Source #

Orphan instances

Arbitrary ClockTime # 
Instance details

Methods

arbitrary :: Gen ClockTime

shrink :: ClockTime -> [ClockTime]