Decode a given ByteString which was originally encoded using encode or
encodeWithIndex.
Modulecardano-prelude-test-0.1.0.5Haskell2010
Test.Cardano.Prelude
- 1 type
- 2 classes
- 56 values
- Packagecardano-prelude-test-0.1.0.5
- Exports59
- LanguageHaskell2010
- LicenceMIT
- SourceBase16.hs
Encodes a given ByteString to base-16 and line wraps every 16 bytes.
Encodes a given ByteString to base-16 and displays it alongside its byte offset (line wrapped every 16 bytes).
Check that eachOf testLimit generated things hasProperty
Check that Canonical JSON decodes to the datatype
Only check that the datatype equals the decoding of the file
Make arbitrary ByteString of given length.
Make arbitrary ByteString.Lazy of given length.
Get something out of a quickcheck Gen without having to do IO
Choose a random (shuffled) subset of length n. Throws an error if there's not enough elements.
Extensional equality combinator. Useful to express function properties as functional equations.
Monadic extensional equality combinator.
Call stopProperty if boolean value is false.
Use stopProperty if the value is Nothing or return something it the value is Just.
A property that is always false
Split given list into chunks with size up to given value. TODO: consider using `sumEquals maxSize (length items)`
Split given integer total into parts parts
TODO: improve naming!
Stop PropertyM execution with given reason. The property will fail.
Generate list of arbitrary positive integers which sum equals given sum. All elements in the list will be smaller or equal then first parameter
Round trip using given encode and decode functions for types with a Buildable instance
ArbitraryUnsafe class ~~~~~~~~~~~~~~~~~~~~~~~~
This class is the same as Arbitrary, except instances of this class for stuff like public/secret keys, VSS shares, commitments etc. are designed not to mimic real data as presisely as possible (using OpenSSL random), but rather to be simple and efficient.
This is especially useful for benchmarking.
Note: we don't need Generic to derive instances of ArbitraryUnsafe.
We can either use one-line instance declaration, or -XStandaloneDeriving
or -XDeriveAnyClass to write something like deriving (Arbitrary, ArbitraryUnsafe).
Methods
arbitraryUnsafe :: Gen a
Instances7ArbitraryUnsafe, …
ArbitraryUnsafe ByteStringDefined in cardano-prelude-test-0.1.0.5 · Test.Cardano.Prelude.QuickCheck.ArbitraryArbitraryUnsafe Word16Defined in cardano-prelude-test-0.1.0.5 · Test.Cardano.Prelude.QuickCheck.ArbitraryArbitraryUnsafe Word32Defined in cardano-prelude-test-0.1.0.5 · Test.Cardano.Prelude.QuickCheck.ArbitraryArbitraryUnsafe Word64Defined in cardano-prelude-test-0.1.0.5 · Test.Cardano.Prelude.QuickCheck.ArbitraryArbitraryUnsafe a => ArbitraryUnsafe (NonEmpty a)Defined in cardano-prelude-test-0.1.0.5 · Test.Cardano.Prelude.QuickCheck.ArbitraryArbitraryUnsafe a => ArbitraryUnsafe [a]Defined in cardano-prelude-test-0.1.0.5 · Test.Cardano.Prelude.QuickCheck.Arbitrary(ArbitraryUnsafe a, ArbitraryUnsafe b) => ArbitraryUnsafe (a, b)Defined in cardano-prelude-test-0.1.0.5 · Test.Cardano.Prelude.QuickCheck.Arbitrary
Type for generating list of unique (nonrepeating) elemets.
Methods
nonrepeating :: Int -> Gen [a]
Constructors
Instances3Eq, Show, Arbitrary
Eq a => Eq (SmallGenerator a)Defined in cardano-prelude-test-0.1.0.5 · Test.Cardano.Prelude.QuickCheck.ArbitraryShow a => Show (SmallGenerator a)Defined in cardano-prelude-test-0.1.0.5 · Test.Cardano.Prelude.QuickCheck.ArbitraryArbitrary a => Arbitrary (SmallGenerator a)Defined in cardano-prelude-test-0.1.0.5 · Test.Cardano.Prelude.QuickCheck.Arbitrary