Programming Clojure (The Pragmatic Programmers) by Alex Miller & Stuart Halloway & Aaron Bedra
Author:Alex Miller & Stuart Halloway & Aaron Bedra [Miller, Alex]
Language: eng
Format: epub
Tags: Pragmatic Bookshelf
Publisher: Pragmatic Bookshelf
Published: 2018-02-22T23:00:00+00:00
Generating Examples
The argument spec we used above was (s/cat :ns (s/? string?) :name string?). To simulate how check generates random arguments from that spec, we can use the s/exercise function, which produces pairs of examples and their conformed values:
(s/exercise (s/cat :ns (s/? string?) :name string?))
-> ([("" "") {:ns "", :name ""}]
[("F" "") {:ns "F", :name ""}]
[("s" "73") {:ns "s", :name "73"}]
[("u") {:name "u"}]
[("") {:name ""}]
[("" "3y") {:ns "", :name "3y"}]
[("t" "9pudu") {:ns "t", :name "9pudu"}]
[("Xhw25" "nPR7C9C") {:ns "Xhw25", :name "nPR7C9C"}]
[("FXs3E" "N") {:ns "FXs3E", :name "N"}]
[("UhUN5dZK1" "le8") {:ns "UhUN5dZK1", :name "le8"}])
This example works, but sometimes spec can’t automatically create a valid generator, or you need to create a custom generator for related arguments. In the following sections, we’ll see how to address these issues. First, let’s consider a case where an s/and spec doesn’t produce any values.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
The Mikado Method by Ola Ellnestam Daniel Brolund(20974)
Hello! Python by Anthony Briggs(20252)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(18611)
Dependency Injection in .NET by Mark Seemann(18407)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(17930)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(17690)
Kotlin in Action by Dmitry Jemerov(17588)
Adobe Camera Raw For Digital Photographers Only by Rob Sheppard(16939)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(16508)
Grails in Action by Glen Smith Peter Ledbrook(15651)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(10484)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(8059)
Microservices with Go by Alexander Shuiskov(7822)
Practical Design Patterns for Java Developers by Miroslav Wengner(7725)
Test Automation Engineering Handbook by Manikandan Sambamurthy(7676)
Angular Projects - Third Edition by Aristeidis Bampakos(7165)
The Art of Crafting User Stories by The Art of Crafting User Stories(6613)
NetSuite for Consultants - Second Edition by Peter Ries(6535)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(6307)