Example of JSVerify failing a test

node v4.9.1
version: 2.0.0
endpointsharetweet
const jsc = require('jsverify') // With property based testing, we don't check for specific inputs and outputs, instead we are testing the boundaries of our code. const additionIsCommutative = jsc.checkForall(jsc.integer, jsc.integer, (a, b) => a + b === b + a) const multiplicationIsDistributive = jsc.checkForall(jsc.integer, jsc.integer, jsc.integer, (a, b, c) => a * (b + c) === a * b + a * c) const subtractionIsCommutative = jsc.checkForall(jsc.integer, jsc.integer, (a, b) => a - b === b - a) // log out whether or not the test passed console.log({ additionIsCommutative, multiplicationIsDistributive, subtractionIsCommutative })
Loading…

no comments

    sign in to comment