2014-02-09 22:52:19 +00:00
|
|
|
package bolt
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Ensure that the page type can be returned in human readable format.
|
2014-04-07 22:24:51 +00:00
|
|
|
func TestPage_typ(t *testing.T) {
|
2014-02-12 21:57:27 +00:00
|
|
|
assert.Equal(t, (&page{flags: branchPageFlag}).typ(), "branch")
|
|
|
|
assert.Equal(t, (&page{flags: leafPageFlag}).typ(), "leaf")
|
|
|
|
assert.Equal(t, (&page{flags: metaPageFlag}).typ(), "meta")
|
|
|
|
assert.Equal(t, (&page{flags: freelistPageFlag}).typ(), "freelist")
|
2014-02-09 22:52:19 +00:00
|
|
|
assert.Equal(t, (&page{flags: 20000}).typ(), "unknown<4e20>")
|
|
|
|
}
|
|
|
|
|
|
|
|
// Ensure that the hexdump debugging function doesn't blow up.
|
2014-04-07 22:24:51 +00:00
|
|
|
func TestPage_dump(t *testing.T) {
|
2014-02-09 22:52:19 +00:00
|
|
|
(&page{id: 256}).hexdump(16)
|
|
|
|
}
|