{"size": 536, "ext": "js", "max_stars_repo_path": "js/test/node/qdigest_tests.js", "max_stars_repo_name": "sengelha/streaming-percentiles-cpp", "max_stars_repo_stars_event_min_datetime": "2018-05-20T20:45:40.000Z", "max_stars_repo_stars_event_max_datetime": "2018-12-05T13:34:28.000Z", "max_issues_repo_path": "js/test/node/qdigest_tests.js", "max_issues_repo_name": "sengelha/streaming-percentiles-cpp", "max_issues_repo_issues_event_min_datetime": "2018-03-12T20:51:16.000Z", "max_issues_repo_issues_event_max_datetime": "2018-12-19T19:17:40.000Z", "max_forks_repo_path": "js/test/node/qdigest_tests.js", "max_forks_repo_name": "sengelha/streaming-percentiles-cpp", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 3, "max_issues_count": 26, "max_forks_count": null, "avg_line_length": 28.2105263158, "max_line_length": 64, "alphanum_fraction": 0.5391791045}
"use strict";

var tape = require('tape');
var sp = require('{sptgt}');

tape("qdigest cf=100 quantiles", function (test) {
    var seq = [];
    for (var i = 0; i < 100000; ++i)
        seq.push(1000 * Math.random());

    var gk = new sp.QDigest(100);
    for (var i = 0; i < seq.length; ++i)
        gk.insert(seq[i]);
    test.ok(gk.quantile(0.1) >= 70 && gk.quantile(0.1) <= 130);
    test.ok(gk.quantile(0.5) >= 470 && gk.quantile(0.5) <= 530);
    test.ok(gk.quantile(0.9) >= 870 && gk.quantile(0.9) <= 930);
    test.end();
});
