untitled notebook

node v10.24.1
version: master
endpointsharetweet
const fc = require('fast-check'); const kvPairArb = fc.tuple(fc.integer(-10, 10), fc.integer()); const kvPairEqual = (a, b) => a[0] === b[0]; fc.statistics( fc.property( fc.set(kvPairArb, kvPairEqual), kvPairArb, () => true // code under test ), ([vs, [k, v]]) => { const label = vs.length === 0 ? 'empty' : Math.min(...vs.map(([kv,vv]) => kv)) >= k ? 'at start' : Math.max(...vs.map(([kv,vv]) => kv)) <= k ? 'at end' : 'at middle'; return label +', ' + (vs.find(([kv,vv]) => kv === k) ? 'update' : 'create'); }, { numRuns: 10000 });
Loading…

no comments

    sign in to comment