Skip to content

AlexBaranosky/Shrink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shrink

An implementation of shrinking, for use in finding the simplest possible failure case in generative test failures. Based off of Haskell's QuickCheck, and Scala's ScalaCheck

Say you have found a test case that fails for the inputted value of 4. The shrink function will return a sequence of integers, [0 2 -2 3 -3], that you can try as inputs to that failing test case. The aim being to identify the smallest possible failure case, which you will then report to the user.

Exs.

(shrink 4) => [0 2 -2 3 -3]
(shrink [1 2]) => [[1] [2] [0 2] [1 0] [1 1] [1 -1]]
(shrink "abc") => ["a" "bc"] 

Usage

Leiningen:

[shrink "0.1.0"]

Example

(shrink [1 2]) 
  ;=> [[1] [2] [0 2] [1 0] [1 1] [1 -1]] 

Versions

Tested against Clojure versions 1.2.0, 1.2.1, 1.3.0, and 1.4.0-beta1

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published