Comparing version 0.8.3 to 0.8.4
## Release History | ||
- **0.8.4** — *2018-10-31* — Updates | ||
- More typings: `oneof`, `tuple`, `either` | ||
- Documentation grammar fixes | ||
- **0.8.3** — *2017-09-11* — Updates | ||
@@ -4,0 +7,0 @@ - Remove Jasmine 1 helper |
@@ -28,3 +28,3 @@ "use strict"; | ||
`g` should be a [right inverse](http://en.wikipedia.org/wiki/Surjective_function#Surjections_as_right_invertible_functions) of `f`, but doesn't need to be complete inverse. | ||
i.e. i.e. `f` doesn't need to be invertible, only surjective. | ||
i.e. `f` doesn't need to be invertible, only surjective. | ||
@@ -51,3 +51,3 @@ ```js | ||
We need an inverse for shrinking, and there right inverse is enough. We can always *pull back* `smap`ped value, shrink the preimage, and *map* or *push forward* shrunken preimages again. | ||
We need an inverse for shrinking, and the right inverse is enough. We can always *pull back* `smap`ped value, shrink the preimage, and *map* or *push forward* shrunken preimages again. | ||
*/ | ||
@@ -54,0 +54,0 @@ function arbitraryBless(arb) { |
@@ -49,2 +49,12 @@ declare namespace JSVerify { | ||
type Property<T> = boolean | void | T; | ||
interface Either<T, U> { | ||
value: T | U; | ||
either<X>(l: (a: T) => X, r: (b: U) => X): X; | ||
isEqual(other: Either<T, U>): boolean; | ||
bimap<X, Y>(f: (a: T) => X, g: (b: U) => Y): Either<X, Y>; | ||
first<X>(f: (a: T) => X): Either<X, U>; | ||
second<Y>(g: (b: U) => Y): Either<T, Y>; | ||
} | ||
type integerFn = (maxsize: number) => Arbitrary<number>; | ||
@@ -81,7 +91,13 @@ type integerFn2 = (minsize: number, maxsize: number) => Arbitrary<number>; | ||
//Combinators | ||
function nonShrink<T>(arb: Arbitrary<T>): Arbitrary<T>; | ||
function either<T, U>(arbA: Arbitrary<T>, arbB: Arbitrary<U>): Arbitrary<T | U>; | ||
function nonshrink<T>(arb: Arbitrary<T>): Arbitrary<T>; | ||
function either<T, U>(arbA: Arbitrary<T>, arbB: Arbitrary<U>): Arbitrary<Either<T,U>>; | ||
function pair<T, U>(arbA: Arbitrary<T>, arbB: Arbitrary<U>): Arbitrary<[T, U]>; | ||
function tuple<A>(arbs: [Arbitrary<A>]): Arbitrary<[A]>; | ||
function tuple<A, B>(arbs: [Arbitrary<A>, Arbitrary<B>]): Arbitrary<[A, B]>; | ||
function tuple<A, B, C>(arbs: [Arbitrary<A>, Arbitrary<B>, Arbitrary<C>]): Arbitrary<[A, B, C]>; | ||
function tuple<A, B, C, D>(arbs: [Arbitrary<A>, Arbitrary<B>, Arbitrary<C>, Arbitrary<D>]): Arbitrary<[A, B, C, D]>; | ||
function tuple<A, B, C, D, E>(arbs: [Arbitrary<A>, Arbitrary<B>, Arbitrary<C>, Arbitrary<D>, Arbitrary<E>]): Arbitrary<[A, B, C, D, E]>; | ||
function tuple(arbs: Arbitrary<any>[]): Arbitrary<any[]>; | ||
function sum(arbs: Arbitrary<any>[]): Arbitrary<any>; | ||
@@ -97,2 +113,6 @@ | ||
function oneof<A, B>(gs: [Arbitrary<A>, Arbitrary<B>]): Arbitrary<A | B>; | ||
function oneof<A, B, C>(gs: [Arbitrary<A>, Arbitrary<B>, Arbitrary<C>]): Arbitrary<A | B | C>; | ||
function oneof<A, B, C, D>(gs: [Arbitrary<A>, Arbitrary<B>, Arbitrary<C>, Arbitrary<D>]): Arbitrary<A | B | C | D>; | ||
function oneof<A, B, C, D, E>(gs: [Arbitrary<A>, Arbitrary<B>, Arbitrary<C>, Arbitrary<D>, Arbitrary<E>]): Arbitrary<A | B | C | D | E>; | ||
function oneof<T>(gs: Arbitrary<T>[]): Arbitrary<T>; | ||
@@ -170,3 +190,3 @@ function record<T>(arbs: { [P in keyof T]: Arbitrary<T[P]> }): Arbitrary<T>; | ||
pair<T, U>(genA: Generator<T>, genB: Generator<U>): Generator<[T, U]>; | ||
either<T, U>(genA: Generator<T>, genB: Generator<U>): Generator<T | U>; | ||
either<T, U>(genA: Generator<T>, genB: Generator<U>): Generator<Either<T, U>>; | ||
@@ -203,3 +223,3 @@ tuple(gens: Generator<any>[]): Generator<any[]>; | ||
pair<T, U>(shrA: Shrink<T>, shrB: Shrink<U>): Shrink<[T, U]>; | ||
either<T, U>(shrA: Shrink<T>, shrB: Shrink<U>): Shrink<T | U>; | ||
either<T, U>(shrA: Shrink<T>, shrB: Shrink<U>): Shrink<Either<T, U>>; | ||
@@ -218,3 +238,3 @@ tuple(shrs: Shrink<any>[]): Shrink<any[]>; | ||
pair<T, U>(sA: Show<T>, sB: Show<U>, x: [T, U]): string; | ||
either<T, U>(sA: Show<T>, sB: Show<U>, x: (T | U)): string; | ||
either<T, U>(sA: Show<T>, sB: Show<U>, x: Either<T, U>): string; | ||
@@ -221,0 +241,0 @@ tuple(shs: Show<any>[], x: any[]): string; |
@@ -84,3 +84,3 @@ /* @flow weak */ | ||
Check [jasmineHelpers.js](helpers/jasmineHelpers.js) and [jasmineHelpers2.js](helpers/jasmineHelpers2.js) for jasmine 1.3 and 2.0 respectively. | ||
Check [jasmineHelpers2.js](helpers/jasmineHelpers2.js) for jasmine 2.0. | ||
@@ -87,0 +87,0 @@ ## API Reference |
/* @flow weak */ | ||
"use strict"; | ||
var arbitraryBless = require("./arbitraryBless"); | ||
var arbitraryBless = require("./arbitraryBless.js"); | ||
var assert = require("assert"); | ||
@@ -6,0 +6,0 @@ var generator = require("./generator.js"); |
@@ -92,2 +92,3 @@ /* @flow weak */ | ||
// eslint-disable-next-line complexity | ||
function loop(a, b, n) { | ||
@@ -94,0 +95,0 @@ if (isNaN(a) && isNaN(b)) { |
{ | ||
"name": "jsverify", | ||
"description": "Property-based testing for JavaScript.", | ||
"version": "0.8.3", | ||
"version": "0.8.4", | ||
"homepage": "http://jsverify.github.io/", | ||
@@ -28,14 +28,14 @@ "author": { | ||
"devDependencies": { | ||
"@types/mocha": "^2.2.40", | ||
"@types/mocha": "^5.0.0", | ||
"bluebird": "^3.1.1", | ||
"browserify": "^14.0.0", | ||
"browserify": "^16.1.1", | ||
"chai": "^4.1.2", | ||
"david": "^11.0.0", | ||
"eslint": "^4.6.1", | ||
"eslint": "^5.8.0", | ||
"esprima": "^4.0.0", | ||
"istanbul": "^0.4.1", | ||
"jasmine-core": "^2.4.1", | ||
"jasmine-core": "^3.1.0", | ||
"jscs": "^3.0.7", | ||
"jshint": "^2.7.0", | ||
"karma": "^1.2.0", | ||
"karma": "^3.1.1", | ||
"karma-chrome-launcher": "^2.0.0", | ||
@@ -48,8 +48,8 @@ "karma-cli": "^1.0.1", | ||
"lodash": "^4.4.0", | ||
"mocha": "^3.0.2", | ||
"mocha": "^5.0.5", | ||
"npm-freeze": "^0.1.3", | ||
"q": "~2.0.2", | ||
"ts-node": "^3.0.0", | ||
"ts-node": "^7.0.1", | ||
"tslint": "^5.0.0", | ||
"typescript": "^2.2.1", | ||
"typescript": "^3.1.4", | ||
"underscore": "^1.8.2", | ||
@@ -56,0 +56,0 @@ "when": "~3.7.2" |
@@ -79,3 +79,3 @@ # JSVerify | ||
Check [jasmineHelpers.js](helpers/jasmineHelpers.js) and [jasmineHelpers2.js](helpers/jasmineHelpers2.js) for jasmine 1.3 and 2.0 respectively. | ||
Check [jasmineHelpers2.js](helpers/jasmineHelpers2.js) for jasmine 2.0. | ||
@@ -244,3 +244,3 @@ ## API Reference | ||
`g` should be a [right inverse](http://en.wikipedia.org/wiki/Surjective_function#Surjections_as_right_invertible_functions) of `f`, but doesn't need to be complete inverse. | ||
i.e. i.e. `f` doesn't need to be invertible, only surjective. | ||
i.e. `f` doesn't need to be invertible, only surjective. | ||
@@ -267,3 +267,3 @@ ```js | ||
We need an inverse for shrinking, and there right inverse is enough. We can always *pull back* `smap`ped value, shrink the preimage, and *map* or *push forward* shrunken preimages again. | ||
We need an inverse for shrinking, and the right inverse is enough. We can always *pull back* `smap`ped value, shrink the preimage, and *map* or *push forward* shrunken preimages again. | ||
@@ -651,2 +651,5 @@ - `bless(arb: {...}): arbitrary a` | ||
- **0.8.4** — *2018-10-31* — Updates | ||
- More typings: `oneof`, `tuple`, `either` | ||
- Documentation grammar fixes | ||
- **0.8.3** — *2017-09-11* — Updates | ||
@@ -653,0 +656,0 @@ - Remove Jasmine 1 helper |
@@ -1,7 +0,6 @@ | ||
import * as jsc from "../lib/jsverify.js"; | ||
import * as jsc from '../lib/jsverify.js'; | ||
const arbitrary: jsc.Arbitrary<number> = jsc.oneof([ | ||
jsc.constant(1), | ||
jsc.constant(2) | ||
jsc.constant(2), | ||
]); | ||
@@ -13,1 +12,32 @@ | ||
]); | ||
const differentTypes1: jsc.Arbitrary<boolean> = jsc.oneof([ | ||
jsc.bool, | ||
]); | ||
const differentTypes2: jsc.Arbitrary<boolean | number> = jsc.oneof([ | ||
jsc.bool, | ||
jsc.number, | ||
]); | ||
const differentTypes3: jsc.Arbitrary<boolean | number | string> = jsc.oneof([ | ||
jsc.bool, | ||
jsc.number, | ||
jsc.string, | ||
]); | ||
const differentTypes4: jsc.Arbitrary<boolean | number | string | { foo: boolean }> = jsc.oneof([ | ||
jsc.bool, | ||
jsc.number, | ||
jsc.string, | ||
jsc.record({ foo: jsc.bool }), | ||
]); | ||
// tslint:disable-next-line:max-line-length | ||
const differentTypes5: jsc.Arbitrary<boolean | number | string | { foo: boolean } | { bar: number }> = jsc.oneof([ | ||
jsc.bool, | ||
jsc.number, | ||
jsc.string, | ||
jsc.record({ foo: jsc.bool }), | ||
jsc.record({ bar: jsc.number }), | ||
]); |
Sorry, the diff of this file is too big to display
255412
48
7352
882