Safe Haskell | None |
---|
Unittests for xm list --long
parser
Synopsis
- genConfig :: Int -> Gen LispConfig
- canBeNumber :: String -> Bool
- canBeNumberChar :: Char -> Bool
- testDomain :: String -> Map String Domain -> Assertion
- testUptimeInfo :: String -> Map Int UptimeInfo -> Assertion
- isAlmostEqual :: LispConfig -> LispConfig -> Property
- serializeConf :: LispConfig -> String
- serializeUptime :: UptimeInfo -> String
- prop_config :: LispConfig -> Property
- prop_uptimeInfo :: UptimeInfo -> Property
- case_xen401list :: Assertion
- case_xen401uptime :: Assertion
- testHypervisor_Xen_XmParser :: Test
Arbitraries
genConfig :: Int -> Gen LispConfig Source #
Generator for ListConfig
.
A completely arbitrary configuration would contain too many lists and its size would be to big to be actually parsable in reasonable time. This generator builds a random Config that is still of a reasonable size, and it also Avoids generating strings that might be interpreted as numbers.
canBeNumber :: String -> Bool Source #
Determines conservatively whether a string could be a number.
canBeNumberChar :: Char -> Bool Source #
Determines whether a char can be part of the string representation of a number (even in scientific notation).
Helper functions for tests
testDomain :: String -> Map String Domain -> Assertion Source #
Function for testing whether a domain configuration is parsed correctly.
testUptimeInfo :: String -> Map Int UptimeInfo -> Assertion Source #
Function for testing whether a xm uptime
output (stored in a file)
is parsed correctly.
isAlmostEqual :: LispConfig -> LispConfig -> Property Source #
Determines whether two LispConfig are equal, with the exception of Double values, that just need to be "almost equal".
Meant mainly for testing purposes, given that Double values may be slightly rounded during parsing.
serializeConf :: LispConfig -> String Source #
Function to serialize LispConfigs in such a way that they can be rebuilt again by the lispConfigParser.
serializeUptime :: UptimeInfo -> String Source #
Function to serialize UptimeInfos in such a way that they can be rebuilt againg by the uptimeLineParser.
prop_config :: LispConfig -> Property Source #
Test whether a randomly generated config can be parsed. Implicitly, this also tests that the Show instance of Config is correct.
prop_uptimeInfo :: UptimeInfo -> Property Source #
Test whether a randomly generated UptimeInfo text line can be parsed.
case_xen401list :: Assertion Source #
Test a Xen 4.0.1 xm list --long
output.
case_xen401uptime :: Assertion Source #
Test a Xen 4.0.1 xm uptime
output.
testHypervisor_Xen_XmParser :: Test Source #
Orphan instances
Arbitrary UptimeInfo # | Generates an arbitrary |
arbitrary :: Gen UptimeInfo shrink :: UptimeInfo -> [UptimeInfo] | |
Arbitrary LispConfig # | Arbitrary instance for |
arbitrary :: Gen LispConfig shrink :: LispConfig -> [LispConfig] |