Safe Haskell | None |
---|---|
Language | Haskell2010 |
- jsonTestsTool :: Name -> APITool
- cborTestsTool :: Name -> APITool
- cborToJSONTestsTool :: Name -> Name -> APITool
- jsonToCBORTestsTool :: Name -> Name -> APITool
- jsonGenericValueTestsTool :: Name -> Name -> APITool
- cborGenericValueTestsTool :: Name -> Name -> APITool
- prop_decodesTo :: forall a. (Eq a, FromJSONWithErrs a) => Value -> a -> Bool
- prop_decodesTo' :: forall a. (Eq a, FromJSONWithErrs a) => ParseFlags -> Value -> a -> Bool
- prop_resultsMatchRoundtrip :: forall a. (Eq a, ToJSON a, FromJSONWithErrs a) => a -> Bool
- prop_cborRoundtrip :: forall a. (Eq a, Serialise a) => a -> Bool
- prop_cborToJSON :: forall a. (Eq a, Serialise a, ToJSON a) => API -> TypeName -> a -> Result
- prop_jsonToCBOR :: forall a. (Eq a, Serialise a, ToJSON a) => API -> TypeName -> a -> Result
Tools
jsonTestsTool :: Name -> APITool Source #
cborTestsTool :: Name -> APITool Source #
jsonGenericValueTestsTool :: Name -> Name -> APITool Source #
Tool to generate a list of tests that the Value
generic
representation agrees with the type-specific JSON representation.
cborGenericValueTestsTool :: Name -> Name -> APITool Source #
Tool to generate a list of tests that the Value
generic
representation agrees with the type-specific CBOR representation.
Properties
prop_decodesTo :: forall a. (Eq a, FromJSONWithErrs a) => Value -> a -> Bool Source #
QuickCheck property that a Value
decodes to an expected Haskell
value, using fromJSONWithErrs
prop_decodesTo' :: forall a. (Eq a, FromJSONWithErrs a) => ParseFlags -> Value -> a -> Bool Source #
QuickCheck property that a Value
decodes to an expected Haskell
value, using fromJSONWithErrs'
with the given ParseFlags
prop_resultsMatchRoundtrip :: forall a. (Eq a, ToJSON a, FromJSONWithErrs a) => a -> Bool Source #
QuickCheck property that Haskell values can be encoded with
toJSON
and decoded with fromJSONWithErrs
to get the original
value
prop_cborRoundtrip :: forall a. (Eq a, Serialise a) => a -> Bool Source #
QuickCheck property that CBOR decoding is a left inverse for encoding
prop_cborToJSON :: forall a. (Eq a, Serialise a, ToJSON a) => API -> TypeName -> a -> Result Source #
QuickCheck property that toJSON
agrees with encoding to CBOR
directly and then decoding using the schema-aware generic decoder.
From this and prop_resultsMatchRoundtrip
it follows that
fromJSONWithErrs . deserialiseJSONWithSchema . serialise == id
prop_jsonToCBOR :: forall a. (Eq a, Serialise a, ToJSON a) => API -> TypeName -> a -> Result Source #
QuickCheck property that direct encoding to CBOR agrees with
conversion to JSON followed by the schema-aware generic encoder.
From this and prop_cborRoundtrip
it follows that
deserialise . serialiseJSONWithSchema . toJSON == id