How to use the better-assert.deepEqual function in better-assert

To help you get started, we’ve selected a few better-assert examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github welch / tdigest / specs / tdigest.spec.js View on Github external
it('reports undefined when given no points', function(){
        var tdigest = new TDigest();
        var p = [0, 0.5, 1.0];
        assert.deepEqual(tdigest.percentile(0.5), undefined);
        assert.deepEqual(tdigest.percentile(p), [undefined,undefined,undefined]);
    });
    it('from a single point', function(){
github welch / tdigest / specs / digest.spec.js View on Github external
it('preserves a discrete distribution', function(){
        var digest = new Digest(); 
        var i, ntimes = 1000, nvals=100;
        for (i = 0 ; i < ntimes ; i++) {
            for (j = 0 ; j < nvals ; j++) {
                digest.push(j);
            }
        }
        var result = digest.toArray();
        for (i = 0 ; i < nvals ; i++) {
            assert.deepEqual(result[i], {mean:i, n:ntimes});
        }
    }); 
    it('compresses a continuous distribution', function(){
github welch / tdigest / specs / discrete.spec.js View on Github external
it('consumes nonnumeric points', function(){
        var tdigest = new TDigest(false); 
        tdigest.push("foo");
        tdigest.push("bar");
        tdigest.push("baz");
        tdigest.push("foo");
        tdigest.push("freen");
        tdigest.push("bork");
        tdigest.push("bork");
        tdigest.push("bork");
        tdigest.push("books");
        var points = tdigest.toArray();
        assert.deepEqual(points, [
            {mean:"bar", n:1},
            {mean:"baz", n:1},
            {mean:"books", n:1},
            {mean:"bork", n:3}, 
            {mean:"foo", n:2},
            {mean:"freen", n:1},
        ]);
    });
    it('consumes same-valued points into a single point', function(){

better-assert

Better assertions for node, reporting the expr, filename, lineno etc

MIT
Latest version published 10 years ago

Package Health Score

68 / 100
Full package analysis

Popular better-assert functions