CrossClj

0.6.1 docs

SourceDocs



RECENT
    VARS
    +-or---digit?
    ->Generator
    any
    any-printable
    bind
    bind-helper
    boolean
    byte
    bytes
    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
    container-type
    elements
    fmap
    frequency
    gen-bind
    gen-fmap
    gen-pure
    Generator
    generator?
    halfs
    hash-map
    int
    int-rose-tree
    keyword
    keyword-ns
    keyword-segment-first
    keyword-segment-rest
    list
    make-gen
    make-size-range-seq
    map
    map->Generator
    namespace
    namespace-segment
    nat
    neg-int
    no-shrink
    not-empty
    one-of
    pick
    pos-int
    rand-range
    random
    recursive-gen
    recursive-helper
    resize
    return
    s-neg-int
    s-pos-int
    sample
    sample-seq
    sequence
    shrink-2
    shrink-int
    shuffle
    simple-type
    simple-type-printable
    sized
    string
    string-alpha-numeric
    string-alphanumeric
    string-ascii
    such-that
    such-that-helper
    swap
    symbol
    symbol-ns
    tuple
    vector

    « 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)
    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)
    (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)
    
    
    Generates one of true or false. Shrinks to false.
    
    Generates integer Numbers [0-255].
    
    Generates byte-arrays.
    
    (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 numbers in the range
    min-range to max-range, inclusive.
    (container-type inner-type)
    (elements coll)
    Create a generator that randomly chooses an element from coll.
    
    Examples:
    
        (gen/elements [:foo :bar :baz])
    
    (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)
    (generator? x)
    Test is x is a generator. Generators should be treated as opaque values.
    
    Private
    (halfs n)
    (hash-map & kvs)
    Like clojure.lang/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 \:)
    
    (list generator)
    Like vector, but generators lists.
    
    (make-gen generator-fn)
    (make-size-range-seq max-size)
    (map key-gen val-gen)
    Create a generator that generates maps, with keys chosen from
    key-gen and values chosen from val-gen.
    (map->Generator G__92054)
    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)
    (random ???)
    (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]))
    
    (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 ???)(sample ???)
    Return a sequence of num-samples (default 10)
    realized values from generator.
    (sample-seq ???)(sample-seq ???)
    Return a sequence of realized values from generator.
    
    Private
    (sequence bind-fn return-fn ms)
    Haskell type:
    Monad m => [m a] -> m [a]
    
    Specfically used here to turn a list of generators
    into a generator of a list.
    (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.
    (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.
    Generate strings. May generate unprintable characters.
    
    Deprecated
    Deprecated - use string-alphanumeric instead.
    
    Generate alphanumeric strings.
    Generate alphanumeric strings.
    
    Generate ascii strings.
    
    (such-that ???)(such-that ???)(such-that ???)
    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
        (such-that not-empty (gen/vector gen/int))
    
    Private
    (such-that-helper max-tries pred gen tries-left rand-seed size)
    Private
    (swap coll [i1 i2])
    Generate symbols without namespaces.
    
    Generate symbols with optional namespaces.
    
    (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]))
    
    (vector ???)(vector ???)
    Create a generator whose elements are chosen from gen. The count of the
    vector will be bounded by the size generator parameter.