CrossClj

0.10.0-alpha3 docs

SourceDocs



RECENT
    VARS
    +-or---digit?
    ->Generator
    abs
    any
    any-printable
    backwards-shrinking-significand
    bind
    bind-helper
    block-bounds
    boolean
    byte
    bytes
    calc-long
    call-gen
    char
    char-alpha
    char-alpha-numeric
    char-alphanumeric
    char-ascii
    char-keyword-first
    char-keyword-rest
    char-symbol-first
    char-symbol-rest
    char-symbol-special
    choose
    coll-distinct-by
    coll-distinct-by*
    container-type
    digit?
    distinct-by?
    double
    double*
    double-exp-and-sign
    double-finite
    elements
    fifty-two-bit-reverse
    fmap
    frequency
    gen-bind
    gen-fmap
    gen-pure
    gen-raw-long
    gen-seq->seq-gen
    generate
    generator?
    get-exponent
    halfs
    hash-map
    int
    int-rose-tree
    keyword
    keyword-ns
    keyword-segment-first
    keyword-segment-rest
    large-integer
    large-integer*
    large-integer**
    lazy-random-states
    let
    list
    list-distinct
    list-distinct-by
    long->large-integer
    make-gen
    make-size-range-seq
    map
    map->Generator
    MAX_INTEGER
    MAX_POS_VALUE
    MIN_INTEGER
    MIN_NEG_VALUE
    namespace
    namespace-segment
    NAN
    nat
    neg-int
    NEG_INFINITY
    no-shrink
    not-empty
    one-of
    pick
    pos-int
    POS_INFINITY
    rand-range
    ratio
    recursive-gen
    recursive-helper
    resize
    return
    s-neg-int
    s-pos-int
    sample
    sample-seq
    scalb
    scale
    set
    shrink-2
    shrink-int
    shuffle
    simple-type
    simple-type-printable
    sized
    sorted-set
    string
    string-alpha-numeric
    string-alphanumeric
    string-ascii
    such-that
    such-that-helper
    swap
    symbol
    symbol-ns
    the-shuffle-fn
    transient-set-contains?
    tuple
    uniform-integer
    uuid
    vector
    vector-distinct
    vector-distinct-by

    « Index of all namespaces of this project

    Private
    (+-or---digit? c d)
    Returns true if c is \+ or \- and d is non-nil and a digit.
    
    Symbols that start with +3 or -2 are not readable because they look
    like numbers.
    (->Generator gen)
    Positional factory function for class clojure.test.check.generators.Generator.
    
    Private
    (abs x)
    A recursive generator that will generate many different, often nested, values
    
    Like any, but avoids characters that the shell will interpret as actions,
    like 7 and 14 (bell and alternate character set command)
    Private
    Generates a 52-bit non-negative integer that shrinks toward having
    fewer lower-order bits (and shrinks to 0 if possible).
    (bind generator k)
    Create a new generator that passes the result of gen into function
    k. k should return a new generator. This allows you to create new
    generators that depend on the value of other generators. For example,
    to create a generator which first generates a vector of integers, and
    then chooses a random element from that vector:
    
        (gen/bind (gen/such-that not-empty (gen/vector gen/int))
                  ;; this function takes a realized vector,
                  ;; and then returns a new generator which
                  ;; chooses a random element from it
                  gen/elements)
    
    
    Private
    (bind-helper k)
    Private
    (block-bounds exp sign)
    Returns [low high], the smallest and largest numbers in the given
    range.
    Generates one of true or false. Shrinks to false.
    
    Generates java.lang.Bytes, using the full byte-range.
    
    Generates byte-arrays.
    
    Private
    (calc-long factor lower upper)
    (call-gen {generator-fn :gen} rnd size)
    Generates character from 0-255.
    
    Generate alpha characters.
    
    Deprecated
    Deprecated - use char-alphanumeric instead.
    
    Generate alphanumeric characters.
    Generate alphanumeric characters.
    
    Generate only ascii character.
    
    Private
    Generate characters that can be the first char of a keyword.
    
    Private
    Generate characters that can be the char following first of a keyword.
    
    Private
    Generate non-alphanumeric characters that can be in a symbol.
    
    (choose lower upper)
    Create a generator that returns long integers in the range lower to upper, inclusive.
    
    Private
    (coll-distinct-by empty-coll key-fn allows-dupes? ordered? gen {:keys [num-elements min-elements max-elements max-tries], :or {max-tries 10}})
    Private
    (coll-distinct-by* empty-coll key-fn shuffle-fn gen rng size num-elements min-elements max-tries)
    Returns a rose tree.
    
    (container-type inner-type)
    Private
    (digit? d)
    Private
    (distinct-by? f coll)
    Like clojure.core/distinct? but takes a collection instead of varargs,
    and returns true for empty collections.
    Generates 64-bit floating point numbers from the entire range,
    including +/- infinity and NaN. Use double* for more control.
    (double* {:keys [infinite? NaN? min max], :or {infinite? true, NaN? true}})
    Generates a 64-bit floating point number. Options:
    
      :infinite? - whether +/- infinity can be generated (default true)
      :NaN?      - whether NaN can be generated (default true)
      :min       - minimum value (inclusive, default none)
      :max       - maximum value (inclusive, default none)
    
    Note that the min/max options must be finite numbers. Supplying a
    min precludes -Infinity, and supplying a max precludes +Infinity.
    Private
    (double-exp-and-sign lower-bound upper-bound)
    Generates [exp sign], where exp is in [-1023, 1023] and sign is 1
    or -1. Only generates values for exp and sign for which there are
    doubles within the given bounds.
    Private
    (double-finite lower-bound upper-bound)
    (elements coll)
    Create a generator that randomly chooses an element from coll.
    
    Examples:
    
        (gen/elements [:foo :bar :baz])
    
    Private
    (fifty-two-bit-reverse n)
    Bit-reverses an integer in the range [0, 2^52).
    
    (fmap f gen)
    (frequency pairs)
    Create a generator that chooses a generator from pairs based on the
    provided likelihoods. The likelihood of a given generator being chosen is
    its likelihood divided by the sum of all likelihoods
    
    Examples:
    
        (gen/frequency [[5 gen/int] [3 (gen/vector gen/int)] [2 gen/boolean]])
    
    (gen-bind {h :gen} k)
    (gen-fmap k {h :gen})
    (gen-pure value)
    Private
    Generates a single uniformly random long, does not shrink.
    
    Private
    (gen-seq->seq-gen gens)
    Takes a sequence of generators and returns a generator of sequences (er, vectors).
    
    (generate generator)(generate generator size)
    Returns a single sample value from the generator, using a default
    size of 30.
    (generator? x)
    Test if x is a generator. Generators should be treated as opaque values.
    
    Private
    (get-exponent x)
    Private
    (halfs n)
    (hash-map & kvs)
    Like clojure.core/hash-map, except the values are generators.
     Returns a generator that makes maps with the supplied keys and
     values generated using the supplied generators.
    
    Examples:
    
      (gen/hash-map :a gen/boolean :b gen/nat)
    
    Generates a positive or negative integer bounded by the generator's
    size parameter.
    (Really returns a long)
    Private
    (int-rose-tree value)
    Generate keywords without namespaces.
    
    Generate keywords with optional namespaces.
    
    Private
    Generate segments of a keyword that can be first (between \:)
    
    Private
    Generate segments of a keyword (between \:)
    
    Generates a platform-native integer from the full available range
    (in clj, 64-bit Longs, and in cljs, numbers between -(2^53 - 1) and
    (2^53 - 1)).
    
    Use large-integer* for more control.
    (large-integer* {:keys [min max]})
    Like large-integer, but accepts options:
    
      :min  the minimum integer (inclusive)
      :max  the maximum integer (inclusive)
    
    Both :min and :max are optional.
    Private
    (large-integer** min max)
    Like large-integer*, but assumes range includes zero.
    
    (lazy-random-states rr)
    Given a random number generator, returns an infinite lazy sequence
    of random number generators.
    macro
    (let bindings & body)
    Macro for building generators using values from other generators.
    Uses a binding vector with the same syntax as clojure.core/let,
    where the right-hand side of the binding pairs are generators, and
    the left-hand side are names (or destructuring forms) for generated
    values.
    
    Subsequent generator expressions can refer to the previously bound
    values, in the same way as clojure.core/let.
    
    The body of the let can be either a value or a generator, and does
    the expected thing in either case. In this way let provides the
    functionality of both bind and fmap.
    
    Examples:
    
      (gen/let [strs (gen/not-empty (gen/list gen/string))
                s (gen/elements strs)]
        {:some-strings strs
         :one-of-those-strings s})
    
      ;; generates collections of "users" that have integer IDs
      ;; from 0...N-1, but are in a random order
      (gen/let [users (gen/list (gen/hash-map :name gen/string-ascii
                                              :age gen/nat))]
        (->> users
             (map #(assoc %2 :id %1) (range))
             (gen/shuffle)))
    (list generator)
    Like vector, but generates lists.
    
    (list-distinct gen)(list-distinct gen opts)
    Generates a list of elements from the given generator, with the
    guarantee that the elements will be distinct.
    
    If the generator cannot or is unlikely to produce enough distinct
    elements, this generator will fail in the same way as such-that.
    
    Available options:
    
      :num-elements  the fixed size of generated vectors
      :min-elements  the min size of generated vectors
      :max-elements  the max size of generated vectors
      :max-tries     the number of times the generator will be tried before
                     failing when it does not produce distinct elements
                     (default 10)
    (list-distinct-by key-fn gen)(list-distinct-by key-fn gen opts)
    Generates a list of elements from the given generator, with the
    guarantee that (map key-fn the-list) will be distinct.
    
    If the generator cannot or is unlikely to produce enough distinct
    elements, this generator will fail in the same way as such-that.
    
    Available options:
    
      :num-elements  the fixed size of generated vectors
      :min-elements  the min size of generated vectors
      :max-elements  the max size of generated vectors
      :max-tries     the number of times the generator will be tried before
                     failing when it does not produce distinct elements
                     (default 10)
    Private
    (long->large-integer bit-count x min max)
    Private
    (make-gen generator-fn)
    (make-size-range-seq max-size)
    (map key-gen val-gen)(map key-gen val-gen opts)
    Create a generator that generates maps, with keys chosen from
    key-gen and values chosen from val-gen.
    
    If the key generator cannot or is unlikely to produce enough distinct
    elements, this generator will fail in the same way as such-that.
    
    Available options:
    
      :num-elements  the fixed size of generated vectors
      :min-elements  the min size of generated vectors
      :max-elements  the max size of generated vectors
      :max-tries     the number of times the generator will be tried before
                     failing when it does not produce distinct elements
                     (default 10)
    (map->Generator m__7585__auto__)
    Factory function for class clojure.test.check.generators.Generator, taking a map of keywords to field values.
    
    Private
    Generate a namespace (or nil for no namespace).
    
    Private
    Generate the segment of a namespace.
    
    Generates natural numbers, starting at zero. Shrinks to zero.
    
    Generate negative integers bounded by the generator's size parameter.
    
    (no-shrink gen)
    Create a new generator that is just like gen, except does not shrink
    at all. This can be useful when shrinking is taking a long time or is not
    applicable to the domain.
    (not-empty gen)
    Modifies a generator so that it doesn't generate empty collections.
    
    Examples:
    
        ;; generate a vector of booleans, but never the empty vector
        (gen/not-empty (gen/vector gen/boolean))
    
    (one-of generators)
    Create a generator that randomly chooses a value from the list of
    provided generators. Shrinks toward choosing an earlier generator,
    as well as shrinking the value generated by the chosen generator.
    
    Examples:
    
        (one-of [gen/int gen/boolean (gen/vector gen/int)])
    
    
    Private
    (pick [h & tail] n)
    Generate positive integers bounded by the generator's size parameter.
    
    Private
    (rand-range rnd lower upper)
    Generates a clojure.lang.Ratio. Shrinks toward 0. Not all values generated
    will be ratios, as many values returned by / are not ratios.
    (recursive-gen container-gen-fn scalar-gen)
    This is a helper for writing recursive (tree-shaped) generators. The first
    argument should be a function that takes a generator as an argument, and
    produces another generator that 'contains' that generator. The vector function
    in this namespace is a simple example. The second argument is a scalar
    generator, like boolean. For example, to produce a tree of booleans:
    
      (gen/recursive-gen gen/vector gen/boolean)
    
    Vectors or maps either recurring or containing booleans or integers:
    
      (gen/recursive-gen (fn [inner] (gen/one-of [(gen/vector inner)
                                                  (gen/map inner inner)]))
                         (gen/one-of [gen/boolean gen/int]))
    
    Private
    (recursive-helper container-gen-fn scalar-gen scalar-size children-size height)
    (resize n generator)
    Create a new generator with size always bound to n.
    
    (return value)
    Create a generator that always returns value,
    and never shrinks. You can think of this as
    the constantly of generators.
    Generate strictly negative integers bounded by the generator's size
    parameter.
    Generate strictly positive integers bounded by the generator's size
    parameter.
    (sample generator)(sample generator num-samples)
    Return a sequence of num-samples (default 10)
    realized values from generator.
    (sample-seq generator)(sample-seq generator max-size)
    Return a sequence of realized values from generator.
    
    Private
    (scalb x exp)
    (scale f generator)
    Create a new generator that modifies the size parameter by the given function. Intended to
    support generators with sizes that need to grow at different rates compared to the normal
    linear scaling.
    (set gen)(set gen opts)
    Generates a set of elements from the given generator.
    
    If the generator cannot or is unlikely to produce enough distinct
    elements, this generator will fail in the same way as such-that.
    
    Available options:
    
      :num-elements  the fixed size of generated vectors
      :min-elements  the min size of generated vectors
      :max-elements  the max size of generated vectors
      :max-tries     the number of times the generator will be tried before
                     failing when it does not produce distinct elements
                     (default 10)
    (shrink-2 gen)
    Create a new generator like gen, but will consider nodes for shrinking
    even if their parent passes the test (up to one additional level).
    Private
    (shrink-int integer)
    (shuffle coll)
    Create a generator that generates random permutations of coll. Shrinks
    toward the original collection: coll. coll will be turned into a vector,
    if it's not already.
    (sized sized-gen)
    Create a generator that depends on the size parameter.
    sized-gen is a function that takes an integer and returns
    a generator.
    (sorted-set gen)(sorted-set gen opts)
    Generates a sorted set of elements from the given generator.
    
    If the generator cannot or is unlikely to produce enough distinct
    elements, this generator will fail in the same way as such-that.
    
    Available options:
    
      :num-elements  the fixed size of generated vectors
      :min-elements  the min size of generated vectors
      :max-elements  the max size of generated vectors
      :max-tries     the number of times the generator will be tried before
                     failing when it does not produce distinct elements
                     (default 10)
    Generate strings. May generate unprintable characters.
    
    Deprecated
    Deprecated - use string-alphanumeric instead.
    
    Generate alphanumeric strings.
    Generate alphanumeric strings.
    
    Generate ascii strings.
    
    (such-that pred gen)(such-that pred gen max-tries)
    Create a generator that generates values from gen that satisfy predicate
    pred. Care is needed to ensure there is a high chance gen will satisfy
    pred. By default, such-that will try 10 times to generate a value that
    satisfies the predicate. If no value passes this predicate after this number
    of iterations, a runtime exception will be throw. You can pass an optional
    third argument to change the number of times tried. Note also that each
    time such-that retries, it will increase the size parameter.
    
    Examples:
    
        ;; generate non-empty vectors of integers
        ;; (note, gen/not-empty does exactly this)
        (gen/such-that not-empty (gen/vector gen/int))
    
    Private
    (such-that-helper max-tries pred gen tries-left rng size)
    Private
    (swap coll [i1 i2])
    Generate symbols without namespaces.
    
    Generate symbols with optional namespaces.
    
    Private
    (the-shuffle-fn rng coll)
    Returns a shuffled version of coll according to the rng.
    
    Note that this is not a generator, it is just a utility function.
    Private
    (transient-set-contains? s k)
    (tuple & generators)
    Create a generator that returns a vector, whose elements are chosen
    from the generators in the same position. The individual elements shrink
    according to their generator, but the value will never shrink in count.
    
    Examples:
    
        (def t (tuple gen/int gen/boolean))
        (sample t)
        ;; => ([1 true] [2 true] [2 false] [1 false] [0 true] [-2 false] [-6 false]
        ;; =>  [3 true] [-4 false] [9 true]))
    
    Private
    (uniform-integer bit-count)
    Generates an integer uniformly in the range 0..(2^bit-count-1).
    
    Generates a random type-4 UUID. Does not shrink.
    
    (vector generator)(vector generator num-elements)(vector generator min-elements max-elements)
    Create a generator whose elements are chosen from gen. The count of the
    vector will be bounded by the size generator parameter.
    (vector-distinct gen)(vector-distinct gen opts)
    Generates a vector of elements from the given generator, with the
    guarantee that the elements will be distinct.
    
    If the generator cannot or is unlikely to produce enough distinct
    elements, this generator will fail in the same way as such-that.
    
    Available options:
    
      :num-elements  the fixed size of generated vectors
      :min-elements  the min size of generated vectors
      :max-elements  the max size of generated vectors
      :max-tries     the number of times the generator will be tried before
                     failing when it does not produce distinct elements
                     (default 10)
    (vector-distinct-by key-fn gen)(vector-distinct-by key-fn gen opts)
    Generates a vector of elements from the given generator, with the
    guarantee that (map key-fn the-vector) will be distinct.
    
    If the generator cannot or is unlikely to produce enough distinct
    elements, this generator will fail in the same way as such-that.
    
    Available options:
    
      :num-elements  the fixed size of generated vectors
      :min-elements  the min size of generated vectors
      :max-elements  the max size of generated vectors
      :max-tries     the number of times the generator will be tried before
                     failing when it does not produce distinct elements
                     (default 10)