package popper

  1. Overview
  2. Docs

Types

type t

Primitives

val pass : t

pass is a proposition that true

val fail : ?loc:string -> (Stdlib.Format.formatter -> unit -> unit) -> t

fail ?loc pp is a failing proposition with location loc if given and printer pp for the error message

val fail_with : ?loc:string -> string -> t

fail_with ?loc msg is a proposition that fails with location loc if given and message msg

val discard : t

discard is a proposition that is discarded.

val equal : ?loc:string -> 'a Comparator.t -> 'a -> 'a -> t

equal ?loc cmp x y returns a proposition pass only if x and y are equal using the given comparator cmp. If loc is passed, it reports the location string in case of failure.

val less_than : ?loc:string -> 'a Comparator.t -> 'a -> 'a -> t

less_than ?loc cmp x y returns a proposition pass only if x is less than y when using the given compartor cmp. If loc is passed, it reports the location string in case of failure.

val greater_than : ?loc:string -> 'a Comparator.t -> 'a -> 'a -> t

greater_than ?loc cmp x y returns a proposition pass only if x is greater than y when using the given compartor cmp. If loc is passed, it reports the location string in case of failure.

val less_equal_than : ?loc:string -> 'a Comparator.t -> 'a -> 'a -> t

less_equal_than ?loc cmp x y returns a proposition pass only if x is less than or equal to y when using the given compartor cmp. If loc is passed, it reports the location string in case of failure.

val greater_equal_than : ?loc:string -> 'a Comparator.t -> 'a -> 'a -> t

greater_equal_than ?loc cmp x y returns a proposition pass only if x is greater than or equal to y when using the given compartor cmp. If loc is passed, it reports the location string in case of failure.

val is_true : ?loc:string -> bool -> t

is_true ?loc b returns a proposition pass if b is true. Otherwise fail with location loc if given.

val is_false : ?loc:string -> bool -> t

is_false ?loc b returns a proposition pass if b is false. Otherwise fail with location loc if given.

Combinators

val all : t list -> t

all ps is a proposition that only passes if all given propositions in ps are pass.

val any : t list -> t

all ps is a proposition that passes if any of the given propositions in ps are pass.