<commit_before>require('proof')(5, require('cadence')(prove))

function prove (async, assert) {
    var Isochronous = require('../..')

    function Service () {
    }

    var expected = {
        stats: {
            scheduled: 20000,
            start: 20004,
            duration: null,
            overflow: false,
            iteration: 0
        },
        message: 'initial stats',
        now: 25034
    }

    Service.prototype.serve = function (callback) {
        assert(isochronous.stats, expected.stats, expected.message)
        now = expected.now
        callback()
    }

    var service = new Service

    var now = 15301
    var _setTimeout = function (callback, when) {
        assert(when, 4699, 'initial timeout')
        _setTimeout = function (callback, when) {
            expected = {
                stats: {
                    scheduled: 25000,
                    start: 25043,
                    duration: 5030,
                    overflow: true,
                    iteration: 1
                },
                message: 'subsequent stats',
                now: now + 2340
            }
            now += 9
            assert(when, 0, 'overflow')
            _setTimeout = function (callback, when) {
                assert(when, 2626, 'final timeout')
                isochronous.stop()
            }
            callback()
        }
        now = 20004
        callback()
    }

    new Isochronous({
        operation: { object: service, method: 'serve' }
    })

    var isochronous = new Isochronous({
        interval: 5000,
        operation: { object: service, method: 'serve' },
        vargs: [],
        _setTimeout: function (callback, when) { _setTimeout(callback, when) },
        _Date: { now: function () { return now } }
    })

    isochronous.stop()

    async(function () {
        isochronous.run(async())
    })
}<commit_msg>Tidy test.<commit_after>require('proof')(5, require('cadence')(prove))

function prove (async, assert) {
    var Isochronous = require('../..')

    function Service () {
    }

    var expected = {
        stats: {
            scheduled: 20000,
            start: 20004,
            duration: null,
            overflow: false,
            iteration: 0
        },
        message: 'initial stats',
        now: 25034
    }

    Service.prototype.serve = function (callback) {
        assert(isochronous.stats, expected.stats, expected.message)
        now = expected.now
        callback()
    }

    var service = new Service

    var now = 15301
    var _setTimeout = function (callback, when) {
        assert(when, 4699, 'initial timeout')
        _setTimeout = function (callback, when) {
            expected = {
                stats: {
                    scheduled: 25000,
                    start: 25043,
                    duration: 5030,
                    overflow: true,
                    iteration: 1
                },
                message: 'subsequent stats',
                now: now + 2340
            }
            now += 9
            assert(when, 0, 'overflow')
            _setTimeout = function (callback, when) {
                assert(when, 2626, 'final timeout')
                isochronous.stop()
            }
            callback()
        }
        now = 20004
        callback()
    }

    new Isochronous({
        operation: { object: service, method: 'serve' }
    })

    var isochronous = new Isochronous({
        interval: 5000,
        operation: { object: service, method: 'serve' },
        vargs: [],
        _setTimeout: function (callback, when) { _setTimeout(callback, when) },
        _Date: { now: function () { return now } }
    })

    isochronous.stop()

    isochronous.run(async())
}
{'fraction_non_alphanumeric': 0.11018766756032172, 'fraction_numerical': 0.032171581769437, 'mean_word_length': 1.456221198156682, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2338578', 'n_tokens_mistral': 1125, 'n_tokens_neox': 989, 'n_words': 254}