<commit_before>#!/usr/bin/env node

require('./proof')(5, function (step, tmp, Strata, ok, equal, load, objectify, say, deepEqual) {
    var fs = require('fs'), strata

    step(function () {

        strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
        strata.create(step())

    }, function () {

        strata.mutator('a', step())

    }, function (cursor) {

        ok(cursor.exclusive, 'exclusive')

        step(function () {

            cursor.insert('a', 'a', ~ cursor.index, step())

        }, function (inserted) {

            equal(inserted, 0, 'inserted')

            cursor.unlock()

            equal(strata.size, 14, 'json size')

        })

    }, function () {

        objectify(tmp, step())
        load(__dirname + '/fixtures/insert.json', step())

    }, function (actual, expected) {

        say(expected)
        say(actual)

        deepEqual(actual, expected, 'insert')

        say(expected.segment00000001)

        strata.purge(0)
        deepEqual(strata.size, 0, 'purged')

        strata.close(step())
    })
})<commit_msg>Tidy `t/basics/insert.t.js`.<commit_after>#!/usr/bin/env node

require('./proof')(5, function (step, Strata, tmp, load, objectify, ok, equal, deepEqual, say) {
    var strata
    step(function () {
        strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
        strata.create(step())
    }, function () {
        strata.mutator('a', step())
    }, function (cursor) {
        ok(cursor.exclusive, 'exclusive')
        step(function () {
            cursor.insert('a', 'a', ~ cursor.index, step())
        }, function (inserted) {
            equal(inserted, 0, 'inserted')
            cursor.unlock()
            equal(strata.size, 14, 'json size')
        })
    }, function () {
        objectify(tmp, step())
        load(__dirname + '/fixtures/insert.json', step())
    }, function (actual, expected) {
        say(expected)
        say(actual)

        deepEqual(actual, expected, 'insert')

        say(expected.segment00000001)

        strata.purge(0)
        deepEqual(strata.size, 0, 'purged')

        strata.close(step())
    })
})
{'fraction_non_alphanumeric': 0.1643389199255121, 'fraction_numerical': 0.0148975791433892, 'mean_word_length': 2.231578947368421, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '74469', 'n_tokens_mistral': 707, 'n_tokens_neox': 651, 'n_words': 139}