Skip to content

Commit

Permalink
Test with a comparator that checks for null keys.
Browse files Browse the repository at this point in the history
Closes #456.
  • Loading branch information
flatheadmill committed Feb 8, 2015
1 parent 71aed44 commit dd9e5b5
Show file tree
Hide file tree
Showing 79 changed files with 105 additions and 95 deletions.
2 changes: 1 addition & 1 deletion t/basics/backward.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function prove (async, assert) {
async(function () {
serialize(__dirname + '/fixtures/merge.before.json', tmp, async())
}, function () {
strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata.open(async())
}, function () {
strata.mutator(strata.leftOf('c'), async())
Expand Down
4 changes: 2 additions & 2 deletions t/basics/create.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function prove (async, assert) {
async(function () {
fs.writeFile(tmp + '/.ignore', '', 'utf8', async())
}, function () {
strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata.create(async())
}, function () {
assert(strata.size, 0, 'total heft')
Expand All @@ -22,7 +22,7 @@ function prove (async, assert) {

assert(actual, expected, 'written')

strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata.open(async())
}, function () {
strata.iterator('a', async())
Expand Down
2 changes: 1 addition & 1 deletion t/basics/delete.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require('./proof')(3, prove)

function prove (async, assert) {
var strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
var strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
async(function () {
serialize(__dirname + '/fixtures/split.before.json', tmp, async())
}, function () {
Expand Down
2 changes: 1 addition & 1 deletion t/basics/get.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function prove (async, assert) {
async(function () {
serialize(__dirname + '/fixtures/get.json', tmp, async())
}, function () {
strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata.open(async())
}, function () {
assert(strata.size, 0, 'json size before read')
Expand Down
2 changes: 1 addition & 1 deletion t/basics/insert.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require('./proof')(4, prove)
function prove (async, assert) {
var strata
async(function () {
strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata.create(async())
}, function () {
strata.mutator('a', async())
Expand Down
2 changes: 1 addition & 1 deletion t/basics/key.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function prove (async, assert) {
async(function () {
serialize(__dirname + '/fixtures/get.json', tmp, async())
}, function () {
strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata.open(async())
}, function () {
strata.iterator(strata.key('a'), async())
Expand Down
2 changes: 1 addition & 1 deletion t/basics/merge.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function prove (async, assert) {
async(function () {
serialize(__dirname + '/fixtures/merge.before.json', tmp, async())
}, function () {
strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata.open(async())
}, function () {
strata.mutator('b', async())
Expand Down
4 changes: 2 additions & 2 deletions t/basics/open.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ require('./proof')(2, prove)
function prove (async, assert) {
var strata
async(function () {
strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata.create(async())
}, function () {
strata.close(async())
}, function () {
strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata.open(async())
}, function () {
assert(strata.size, 0, 'json size')
Expand Down
2 changes: 1 addition & 1 deletion t/basics/resize.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function prove (async, assert) {
async(function () {
serialize(__dirname + '/fixtures/resize.before.json', tmp, async())
}, function () {
strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata.open(async())
}, function () {
strata.iterator('b', async())
Expand Down
2 changes: 1 addition & 1 deletion t/basics/right.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function prove (async, assert) {
async(function () {
serialize(__dirname + '/fixtures/merge.before.json', tmp, async())
}, function () {
strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata.open(async())
}, function () {
strata.mutator(strata.right, async())
Expand Down
2 changes: 1 addition & 1 deletion t/basics/split.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function prove (async, assert) {
async(function () {
serialize(__dirname + '/fixtures/split.before.json', tmp, async())
}, function () {
strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata.open(async())
}, function () {
strata.mutator('b', async())
Expand Down
2 changes: 1 addition & 1 deletion t/basics/vivify.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function prove (async, assert) {
async(function () {
serialize(__dirname + '/fixtures/vivify.json', tmp, async())
}, function () {
strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata.open(async())
}, function () {
strata.vivify(async())
Expand Down
4 changes: 2 additions & 2 deletions t/binary/serialize.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require('./proof')(1, prove)
function prove (async, assert) {
var strata
async(function () {
strata = new Strata({
strata = createStrata({
directory: tmp,
serialize: function (string) { return new Buffer(string) },
deserialize: function (buffer) { return buffer.toString() }
Expand All @@ -22,7 +22,7 @@ function prove (async, assert) {
}, function () {
strata.close(async())
}, function () {
strata = new Strata({
strata = createStrata({
directory: tmp,
serialize: function (string) { return new Buffer(string) },
deserialize: function (buffer) { return buffer.toString() }
Expand Down
2 changes: 1 addition & 1 deletion t/coverage/already-balancing.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function prove (async, assert) {
async(function () {
serialize(__dirname + '/../basics/fixtures/split.before.json', tmp, async())
}, function () {
strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata.open(async())
}, function () {
strata.mutator('b', async())
Expand Down
2 changes: 1 addition & 1 deletion t/coverage/balancer-cached-right.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require('./proof')(2, prove)

function prove (async, assert) {
var strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
var strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
async(function () {
serialize(__dirname + '/fixtures/balancer-cached-right.json', tmp, async())
}, function () {
Expand Down
4 changes: 2 additions & 2 deletions t/coverage/checksum-constructor.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ function prove (async, assert) {
async(function () {
fs.writeFile(tmp + '/.ignore', '', 'utf8', async())
}, function () {
strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata.create(async())
}, function () {
strata.close(async())
}, function () {
strata = new Strata({
strata = createStrata({
directory: tmp,
leafSize: 3,
branchSize: 3,
Expand Down
2 changes: 1 addition & 1 deletion t/coverage/directory-is-not-empty.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require('./proof')(1, prove)

function prove (async, assert) {
var strata = new Strata({ directory: __dirname })
var strata = createStrata({ directory: __dirname })
async([function () {
strata.create(async())
}, function (error) {
Expand Down
2 changes: 1 addition & 1 deletion t/coverage/large-leaf.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require('./proof')(2, prove)

function prove (async, assert) {
var strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
var strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
async(function () {
serialize(__dirname + '/fixtures/large-leaf.before.json', tmp, async())
}, function () {
Expand Down
4 changes: 2 additions & 2 deletions t/coverage/length-adjust.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require('./proof')(1, prove)
function prove (async, assert) {
var strata, value = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTU'
async(function () {
strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata.create(async())
}, function () {
strata.mutator(value, async())
Expand All @@ -18,7 +18,7 @@ function prove (async, assert) {
}, function () {
strata.close(async())
}, function () {
strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata.open(async())
}, function () {
gather(strata, async())
Expand Down
2 changes: 1 addition & 1 deletion t/coverage/null-checksum.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require('./proof')(1, prove)

function prove (async, assert) {
var fs = require('fs'), path = require('path')
var strata = new Strata({ directory: tmp, checksum: 'none' })
var strata = createStrata({ directory: tmp, checksum: 'none' })
async(function () {
strata.create(async())
}, function () {
Expand Down
2 changes: 1 addition & 1 deletion t/coverage/propagation.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require('./proof')(1, prove)
function prove (async, assert) {
var strata
async(function () {
strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata.create(async())
}, function () {
try {
Expand Down
2 changes: 1 addition & 1 deletion t/coverage/read-leaf-start.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require('./proof')(1, prove)

function prove (async, assert) {
var strata = new Strata({
var strata = createStrata({
directory: tmp,
branchSize: 3,
leafSize: 3,
Expand Down
4 changes: 2 additions & 2 deletions t/coverage/read-line.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function prove (async, assert) {
async(function () {
fs.writeFile(tmp + '/0.0', '6 x_x\n', 'utf8', async())
}, function () {
strata = new Strata({ directory: tmp })
strata = createStrata({ directory: tmp })
strata.open(async())
}, [function () {
strata.iterator('a', async())
Expand All @@ -16,7 +16,7 @@ function prove (async, assert) {
}], function () {
fs.writeFile(tmp + '/0.0', '6 x 0\n', 'utf8', async())
}, function () {
strata = new Strata({ directory: tmp })
strata = createStrata({ directory: tmp })
strata.open(async())
}, [function () {
strata.iterator('a', async())
Expand Down
2 changes: 1 addition & 1 deletion t/coverage/read-record-overflow.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require('./proof')(1, prove)

function prove (async, assert) {
var strata = new Strata({
var strata = createStrata({
directory: tmp,
branchSize: 3,
leafSize: 3,
Expand Down
4 changes: 2 additions & 2 deletions t/coverage/replay-remove.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require('./proof')(1, prove)
function prove (async, assert) {
var strata
async(function () {
strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata.create(async())
}, function () {
strata.mutator('a', async())
Expand All @@ -25,7 +25,7 @@ function prove (async, assert) {
assert(records, [], 'empty')
strata.close(async())
}, function () {
strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata.open(async())
}, function () {
strata.iterator('a', async())
Expand Down
4 changes: 2 additions & 2 deletions t/coverage/replay.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require('./proof')(1, prove)
function prove (async, assert) {
var strata
async(function () {
strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata.create(async())
}, function () {
strata.mutator('a', async())
Expand All @@ -23,7 +23,7 @@ function prove (async, assert) {
assert(records, [ 'a' ], 'written')
strata.close(async())
}, function () {
strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3, replay: true })
strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3, replay: true })
strata.open(async())
}, function () {
strata.iterator('a', async())
Expand Down
2 changes: 1 addition & 1 deletion t/coverage/set-immediate.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function prove (async, assert) {
async(function () {
serialize(__dirname + '/../basics/fixtures/get.json', tmp, async())
}, function () {
strata = new Strata({
strata = createStrata({
directory: tmp,
leafSize: 3,
branchSize: 3,
Expand Down
2 changes: 1 addition & 1 deletion t/coverage/split-race.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function prove (async, assert) {
async(function () {
serialize(__dirname + '/fixtures/split-race.before.json', tmp, async())
}, function () {
strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3, tracer: tracer })
strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3, tracer: tracer })
strata.open(async())
}, function () {
strata.mutator('d', async())
Expand Down
2 changes: 1 addition & 1 deletion t/coverage/upgrade.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function prove (async, assert) {
async(function () {
serialize(__dirname + '/fixtures/split-race.before.json', tmp, async())
}, function () {
strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3, tracer: tracer })
strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3, tracer: tracer })
strata.open(async())
}, function () {
strata.mutator('d', async())
Expand Down
4 changes: 2 additions & 2 deletions t/coverage/validator.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
require('./proof')(2, prove)

function prove (async, assert) {
var strata = new Strata({ directory: __filename })
var strata = createStrata({ directory: __filename })

strata.create(function (error) {
assert(/is not a directory.$/.test(error.message), 'thrown')
})

strata = new Strata({ directory: tmp, fs: {
strata = createStrata({ directory: tmp, fs: {
stat: function (file, callback) { callback(new Error('errored')) }
}})

Expand Down
2 changes: 1 addition & 1 deletion t/coverage/write.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function prove (async, assert) {
}
}

var strata = new Strata({ directory: tmp, fs: proxy, leafSize: 3 })
var strata = createStrata({ directory: tmp, fs: proxy, leafSize: 3 })
async(function () {
serialize(__dirname + '/../basics/fixtures/split.before.json', tmp, async())
}, function () {
Expand Down
4 changes: 2 additions & 2 deletions t/delete/ghost.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require('./proof')(5, prove)

function prove (async, assert) {
var strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
var strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
async(function () {
serialize(__dirname + '/fixtures/delete.json', tmp, async())
}, function () {
Expand Down Expand Up @@ -32,7 +32,7 @@ function prove (async, assert) {
assert(actual, expected, 'directory')
strata.close(async())
}, function () {
strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
strata.open(async())
}, function () {
strata.iterator('a', async())
Expand Down
2 changes: 1 addition & 1 deletion t/ghost/empty.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require('./proof')(1, prove)

function prove (async, assert) {
var strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
var strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
async(function () {
serialize(__dirname + '/fixtures/empty.before.json', tmp, async())
}, function () {
Expand Down
2 changes: 1 addition & 1 deletion t/ghost/exorcise.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require('./proof')(5, prove)

function prove (async, assert) {
var strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
var strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
async(function () {
serialize(__dirname + '/fixtures/exorcise.before.json', tmp, async())
}, function () {
Expand Down
2 changes: 1 addition & 1 deletion t/ghost/first.t.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require('./proof')(2, prove)

function prove (async, assert) {
var strata = new Strata({ directory: tmp, leafSize: 3, branchSize: 3 })
var strata = createStrata({ directory: tmp, leafSize: 3, branchSize: 3 })
async(function () {
serialize(__dirname + '/fixtures/first.before.json', tmp, async())
}, function () {
Expand Down
Loading

0 comments on commit dd9e5b5

Please sign in to comment.