Safe Haskell | None |
---|
Unittests for ganeti-htools.
Synopsis
- genFilter :: Gen (Filter FilterField)
- genFilter' :: Int -> Gen (Filter FilterField)
- genJSValue :: Gen JSValue
- genResultEntry :: Gen ResultEntry
- prop_filter_serialisation :: Property
- prop_filterregex_instances :: FilterRegex -> Property
- prop_resultstatus_serialisation :: ResultStatus -> Property
- prop_fieldtype_serialisation :: FieldType -> Property
- prop_fielddef_serialisation :: FieldDefinition -> Property
- prop_resultentry_serialisation :: Property
- prop_fieldsresult_serialisation :: Property
- prop_itemtype_serialisation :: ItemType -> Property
- case_filterParsing :: Assertion
- testQuery_Language :: Test
Documentation
genFilter :: Gen (Filter FilterField) Source #
Custom Filter
generator (top-level), which enforces a
(sane) limit on the depth of the generated filters.
genFilter' :: Int -> Gen (Filter FilterField) Source #
Custom generator for filters that correctly halves the state of the generators at each recursive step, per the QuickCheck documentation, in order not to run out of memory.
genJSValue :: Gen JSValue Source #
Generates an arbitrary JSValue. We do this via a function a not
via arbitrary instance since that would require us to define an
arbitrary for JSValue, which can be recursive, entering the usual
problems with that; so we only generate the base types, not the
recursive ones, and not JSNull
, which we can't use in a
RSNormal
ResultEntry
.
genResultEntry :: Gen ResultEntry Source #
Generates a ResultEntry
value.
prop_filter_serialisation :: Property Source #
Tests that serialisation/deserialisation of filters is idempotent.
prop_filterregex_instances :: FilterRegex -> Property Source #
Tests that filter regexes are serialised correctly.
prop_resultstatus_serialisation :: ResultStatus -> Property Source #
Tests ResultStatus
serialisation.
prop_fieldtype_serialisation :: FieldType -> Property Source #
Tests FieldType
serialisation.
prop_fielddef_serialisation :: FieldDefinition -> Property Source #
Tests FieldDef
serialisation.
prop_resultentry_serialisation :: Property Source #
Tests ResultEntry
serialisation. Needed especially as this is
done manually, and not via buildObject (different serialisation
format).
prop_fieldsresult_serialisation :: Property Source #
Tests FieldDef
serialisation. We use a made-up maximum limit of
20 for the generator, since otherwise the lists become too long and
we don't care so much about list length but rather structure.
prop_itemtype_serialisation :: ItemType -> Property Source #
Tests ItemType
serialisation.
case_filterParsing :: Assertion Source #
Tests basic cases of filter parsing, including legacy ones.
testQuery_Language :: Test Source #
Orphan instances
Arbitrary ResultStatus # | |
arbitrary :: Gen ResultStatus shrink :: ResultStatus -> [ResultStatus] | |
Arbitrary FieldType # | |
Arbitrary QueryTypeOp # | |
arbitrary :: Gen QueryTypeOp shrink :: QueryTypeOp -> [QueryTypeOp] | |
Arbitrary QueryTypeLuxi # | |
arbitrary :: Gen QueryTypeLuxi shrink :: QueryTypeLuxi -> [QueryTypeLuxi] | |
Arbitrary FilterRegex # | |
arbitrary :: Gen FilterRegex shrink :: FilterRegex -> [FilterRegex] | |
Arbitrary ItemType # | |
Arbitrary FieldDefinition # | |
arbitrary :: Gen FieldDefinition shrink :: FieldDefinition -> [FieldDefinition] | |
Arbitrary QueryFieldsResult # | |
arbitrary :: Gen QueryFieldsResult shrink :: QueryFieldsResult -> [QueryFieldsResult] | |
Arbitrary (Filter FilterField) # | |
arbitrary :: Gen (Filter FilterField) shrink :: Filter FilterField -> [Filter FilterField] |