Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/xsc/ronda-gen

test.check generators for ronda (and other) schemas
https://github.com/xsc/ronda-gen

Last synced: 27 days ago
JSON representation

test.check generators for ronda (and other) schemas

Awesome Lists containing this project

README

        

# ronda-gen

__ronda-gen__ offers [test.check][test-check] generators based on
[prismatic/schema][schema].

See [schema-gen][schema-gen] for a similar (and in parts surely identical)
approach.

## Usage

Don't.

```clojure
(require '[ronda.gen :as r]
'[schema.core :as s])

(r/sample
{:first-name s/Str
:last-name s/Str
:age (s/both s/Int (s/pred #(>= % 18)))}
5)
;; => ({:first-name "", :last-name "", :age 18}
;; {:first-name "", :last-name "S", :age 23}
;; {:first-name "", :last-name "", :age 18}
;; {:first-name "", :last-name "CgF", :age 21}
;; {:first-name "s", :last-name "aRkl", :age 22})

(r/generator {:x s/Int})
;; => #clojure.test.check.generators.Generator{:gen ...}
```

## License

Copyright © 2015 Yannick Scherer

Distributed under the Eclipse Public License either version 1.0 or (at
your option) any later version.

[schema]: https://github.com/prismatic/schema
[test-check]: https://github.com/clojure/test.check
[schema-gen]: https://github.com/zeeshanlakhani/schema-gen