creditmonad-1.0.0: Reasoning about amortized time complexity
Safe HaskellNone
LanguageGHC2021

Test.Credit

Synopsis

Common time-complexity functions

data Size Source #

Instances

Instances details
Enum Size Source # 
Instance details

Defined in Test.Credit

Methods

succ :: Size -> Size #

pred :: Size -> Size #

toEnum :: Int -> Size #

fromEnum :: Size -> Int #

enumFrom :: Size -> [Size] #

enumFromThen :: Size -> Size -> [Size] #

enumFromTo :: Size -> Size -> [Size] #

enumFromThenTo :: Size -> Size -> Size -> [Size] #

Num Size Source # 
Instance details

Defined in Test.Credit

Methods

(+) :: Size -> Size -> Size #

(-) :: Size -> Size -> Size #

(*) :: Size -> Size -> Size #

negate :: Size -> Size #

abs :: Size -> Size #

signum :: Size -> Size #

fromInteger :: Integer -> Size #

Integral Size Source # 
Instance details

Defined in Test.Credit

Methods

quot :: Size -> Size -> Size #

rem :: Size -> Size -> Size #

div :: Size -> Size -> Size #

mod :: Size -> Size -> Size #

quotRem :: Size -> Size -> (Size, Size) #

divMod :: Size -> Size -> (Size, Size) #

toInteger :: Size -> Integer #

Real Size Source # 
Instance details

Defined in Test.Credit

Methods

toRational :: Size -> Rational #

Show Size Source # 
Instance details

Defined in Test.Credit

Methods

showsPrec :: Int -> Size -> ShowS #

show :: Size -> String #

showList :: [Size] -> ShowS #

Eq Size Source # 
Instance details

Defined in Test.Credit

Methods

(==) :: Size -> Size -> Bool #

(/=) :: Size -> Size -> Bool #

Ord Size Source # 
Instance details

Defined in Test.Credit

Methods

compare :: Size -> Size -> Ordering #

(<) :: Size -> Size -> Bool #

(<=) :: Size -> Size -> Bool #

(>) :: Size -> Size -> Bool #

(>=) :: Size -> Size -> Bool #

max :: Size -> Size -> Size #

min :: Size -> Size -> Size #

Pretty Size Source # 
Instance details

Defined in Test.Credit

Methods

pretty :: Size -> Doc ann #

prettyList :: [Size] -> Doc ann #

Monad m => MemoryCell m Size Source # 
Instance details

Defined in Test.Credit

Methods

prettyCell :: Size -> m Memory Source #

Tree shapes for testing

data Strategy Source #

Constructors

Path 
Bloom 
Pennant 
Random 

Instances

Instances details
Show Strategy Source # 
Instance details

Defined in Test.Credit

Eq Strategy Source # 
Instance details

Defined in Test.Credit

Ord Strategy Source # 
Instance details

Defined in Test.Credit

Testing data structures on trees of operations

class (Arbitrary op, Show op) => DataStructure (t :: (Type -> Type) -> Type) op | t -> op where Source #

Methods

create :: forall (m :: Type -> Type). MonadInherit m => t m Source #

action :: MonadInherit m => t m -> op -> (Credit, m (t m)) Source #

Instances

Instances details
(Arbitrary a, BoundedDeque q, Show a) => DataStructure (BD q a) (DequeOp a) Source # 
Instance details

Defined in Test.Credit.Deque.Base

Methods

create :: forall (m :: Type -> Type). MonadInherit m => BD q a m Source #

action :: MonadInherit m => BD q a m -> DequeOp a -> (Credit, m (BD q a m)) Source #

(Arbitrary a, BoundedDeque q, Show a) => DataStructure (D q a) (DequeOp a) Source # 
Instance details

Defined in Test.Credit.Deque.Base

Methods

create :: forall (m :: Type -> Type). MonadInherit m => D q a m Source #

action :: MonadInherit m => D q a m -> DequeOp a -> (Credit, m (D q a m)) Source #

(Arbitrary a, Ord a, BoundedHeap h, Show a) => DataStructure (BH h a) (HeapOp a) Source # 
Instance details

Defined in Test.Credit.Heap.Base

Methods

create :: forall (m :: Type -> Type). MonadInherit m => BH h a m Source #

action :: MonadInherit m => BH h a m -> HeapOp a -> (Credit, m (BH h a m)) Source #

(Arbitrary a, Ord a, BoundedHeap h, Show a) => DataStructure (H h a) (HeapOp a) Source # 
Instance details

Defined in Test.Credit.Heap.Base

Methods

create :: forall (m :: Type -> Type). MonadInherit m => H h a m Source #

action :: MonadInherit m => H h a m -> HeapOp a -> (Credit, m (H h a m)) Source #

(Arbitrary a, BoundedQueue q, Show a) => DataStructure (Q q a) (QueueOp a) Source # 
Instance details

Defined in Test.Credit.Queue.Base

Methods

create :: forall (m :: Type -> Type). MonadInherit m => Q q a m Source #

action :: MonadInherit m => Q q a m -> QueueOp a -> (Credit, m (Q q a m)) Source #

(Arbitrary a, BoundedRandomAccess q, Show a) => DataStructure (RA q a) (RandomAccessOp a) Source # 
Instance details

Defined in Test.Credit.RandomAccess.Base

Methods

create :: forall (m :: Type -> Type). MonadInherit m => RA q a m Source #

action :: MonadInherit m => RA q a m -> RandomAccessOp a -> (Credit, m (RA q a m)) Source #

(Arbitrary a, Ord a, BoundedSortable q, Show a) => DataStructure (S q a) (SortableOp a) Source # 
Instance details

Defined in Test.Credit.Sortable.Base

Methods

create :: forall (m :: Type -> Type). MonadInherit m => S q a m Source #

action :: MonadInherit m => S q a m -> SortableOp a -> (Credit, m (S q a m)) Source #

runTree :: forall (t :: (Type -> Type) -> Type) op. DataStructure t op => Tree op -> Either Error () Source #

checkCredits :: forall (t :: (Type -> Type) -> Type) op. DataStructure t op => Strategy -> Property Source #

Evaluate the queue operations using the given strategy on the given queue Reports only if evaluation succeeded.

runTreeMemory :: forall (t :: (Type -> Type) -> Type) op. (MemoryStructure t, DataStructure t op) => Tree op -> String Source #

checkCreditsMemory :: forall (t :: (Type -> Type) -> Type) op. (MemoryStructure t, DataStructure t op) => Strategy -> Property Source #

Evaluate the queue operations using the given strategy on the given queue Reports only if evaluation succeeded.