lol-0.7.0.0: A library for lattice cryptography.

Copyright(c) Eric Crockett 2011-2017
Chris Peikert 2011-2017
LicenseGPL-3
Maintainerecrockett0@email.com
Stabilityexperimental
PortabilityPOSIX \( \def\C{\mathbb{C}} \)
Safe HaskellNone
LanguageHaskell2010

Crypto.Lol.Tests

Contents

Description

Tests for individual layers of the Lol stack (Tensor, UCyc, Crypto.Lol.Cyclotomic.Cyc'), plus default parameters and helper functions for displaying results.

Synopsis

Default parameters for tests

defaultZqTests :: Test Source #

Default parameters for ZqBasic tests.

cycTests :: (forall m r. (Fact m, Eq r) => Eq (t m r), forall m r. (Fact m, Show r) => Show (t m r), _) => Proxy t -> Test Source #

Tests for different layers of Lol

tensorCrtTests1 :: forall t m r. _ => Gen r -> Gen (t m r) -> Test Source #

tensorCrtTests2 :: forall t m m' r. _ => Proxy '(t, m, m', r) -> Gen (t m r) -> Test Source #

tensorTests1 :: forall t m r. _ => Gen (t m r) -> Test Source #

tensorTests2 :: forall t m m' r. _ => Proxy '(t, m, m', r) -> Gen (t m r) -> Test Source #

cycTests1 :: forall t m r. (Fact m, _) => Gen (Cyc t m r) -> Test Source #

Tests for single-index Cyc operations. There must be a CRT basis for \(O_m\) over r.

cycTests2 :: forall t m m' r. _ => Proxy '(t, m, m', r) -> Gen (Cyc t m' r) -> Test Source #

Tests for inter-ring Cyc operations. There must be a CRT basis for \(O_{m'}\) over r.

zqTests :: forall r. (Mod r, _) => Proxy r -> Test Source #

Tests for modular arithmetic implementations.

Utilities for creating tests

nestGroup :: String -> [Gen a -> Test] -> Gen a -> Test Source #

Apply parameters to a list of Test.

testIOWithGen :: (Show a, Testable prop) => String -> (a -> IO prop) -> Gen a -> Test Source #

Make a Test given a name, a monadic (IO only) testing function, and a parameter generator

testIOWithoutGen :: Testable prop => String -> IO prop -> Test Source #

Make a Test given a name and a monadic (IO only) Testable value

testWithGen :: (Show a, Testable prop) => String -> (a -> prop) -> Gen a -> Test Source #

Make a Test given a name, a testing function, and a parameter generator

testWithoutGen :: Testable prop => String -> prop -> Test Source #

Make a Test given a name and a Testable value

class ApproxEqual a where Source #

Methods

(=~=) :: a -> a -> Bool Source #

Instances
ApproxEqual Double Source # 
Instance details

Defined in Crypto.Lol.Utils.Tests

Methods

(=~=) :: Double -> Double -> Bool Source #

ApproxEqual Int64 Source # 
Instance details

Defined in Crypto.Lol.Utils.Tests

Methods

(=~=) :: Int64 -> Int64 -> Bool Source #

ApproxEqual (Complex Double) Source # 
Instance details

Defined in Crypto.Lol.Utils.Tests

Eq r => ApproxEqual (ZqBasic q r) Source # 
Instance details

Defined in Crypto.Lol.Utils.Tests

Methods

(=~=) :: ZqBasic q r -> ZqBasic q r -> Bool Source #

choose :: Random a => (a, a) -> Gen a #

Generates a random element in the given inclusive range.

chooseAny :: Random a => Gen a #

Generates a random element over the natural range of a.

testGroup :: TestName -> [Test] -> Test #

Assemble a number of tests into a cohesive group

data Gen a #

A generator for values of type a.

The third-party packages QuickCheck-GenT and quickcheck-transformer provide monad transformer versions of Gen.

Instances
Monad Gen 
Instance details

Defined in Test.QuickCheck.Gen

Methods

(>>=) :: Gen a -> (a -> Gen b) -> Gen b #

(>>) :: Gen a -> Gen b -> Gen b #

return :: a -> Gen a #

fail :: String -> Gen a #

Functor Gen 
Instance details

Defined in Test.QuickCheck.Gen

Methods

fmap :: (a -> b) -> Gen a -> Gen b #

(<$) :: a -> Gen b -> Gen a #

MonadFix Gen 
Instance details

Defined in Test.QuickCheck.Gen

Methods

mfix :: (a -> Gen a) -> Gen a #

Applicative Gen 
Instance details

Defined in Test.QuickCheck.Gen

Methods

pure :: a -> Gen a #

(<*>) :: Gen (a -> b) -> Gen a -> Gen b #

liftA2 :: (a -> b -> c) -> Gen a -> Gen b -> Gen c #

(*>) :: Gen a -> Gen b -> Gen b #

(<*) :: Gen a -> Gen b -> Gen a #

Testable prop => Testable (Gen prop) 
Instance details

Defined in Test.QuickCheck.Property

Methods

property :: Gen prop -> Property #

propertyForAllShrinkShow :: Gen a -> (a -> [a]) -> (a -> [String]) -> (a -> Gen prop) -> Property #

data Test #

Main test data type: builds up a list of tests to be run. Users should use the utility functions in e.g. the test-framework-hunit and test-framework-quickcheck2 packages to create instances of Test, and then build them up into testsuites by using testGroup and lists.

For an example of how to use test-framework, please see http://github.com/batterseapower/test-framework/raw/master/example/Test/Framework/Example.lhs

Utilities for showing benchmark results