ouroboros-consensus
Safe HaskellNone
LanguageHaskell2010

Test.Consensus.Genesis.TestSuite.SmallKey.Tests

Synopsis

Documentation

testsTestTree Source #

Unit tests for the correct derivation of some simple ADT SmallKey instances and a test asserting failure for each black-listing strategy:

  1. A type with a product on its generic representation.
  2. A type with a explicitly black-listed field.

NOTE: These tests depend on -fdefer-type-errors to run.

TODO: Once the use of TypeError is replaced with Unsatisfiable in SmallKey it should be possible to assertError the actual type error instead of the unreacheable runtime error from getAllKeys, and write a test case for the forbidden directly recursive types, e.g.

data DirectlyRecursive = Nil | More DirectlyRecursive
  deriving stock (Eq, Ord, Generic)
  deriving SmallKey via Generically DirectlyRecursive

for which the corresponding test would not terminate trying to evaluate getAllKeys otherwise. See TODO [BlackList].