diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-02-11 12:16:12 -0700 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-02-12 11:49:57 -0700 |
commit | 7bb878ff695b89b62483dd6155f5815ad0d06258 (patch) | |
tree | 1ec591c5aca7bfc099a98433f6a7b01e28c1d9db /db_test.go | |
parent | Merge branch 'master' of https://github.com/boltdb/bolt (diff) | |
download | dedo-7bb878ff695b89b62483dd6155f5815ad0d06258.tar.gz dedo-7bb878ff695b89b62483dd6155f5815ad0d06258.tar.xz |
Mmap remap.
Diffstat (limited to 'db_test.go')
-rw-r--r-- | db_test.go | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -187,6 +187,18 @@ func TestDBWriteFail(t *testing.T) { t.Skip("pending") // TODO(benbjohnson) } +// Ensure that the mmap grows appropriately. +func TestDBMmapSize(t *testing.T) { + db := &DB{pageSize: 4096} + assert.Equal(t, db.mmapSize(0), minMmapSize) + assert.Equal(t, db.mmapSize(16384), minMmapSize) + assert.Equal(t, db.mmapSize(minMmapSize-1), minMmapSize) + assert.Equal(t, db.mmapSize(minMmapSize), minMmapSize*2) + assert.Equal(t, db.mmapSize(10000000), 20000768) + assert.Equal(t, db.mmapSize((1<<30)-1), 2147483648) + assert.Equal(t, db.mmapSize(1<<30), 1<<31) +} + // withDB executes a function with a database reference. func withDB(fn func(*DB, string)) { f, _ := ioutil.TempFile("", "bolt-") |