From a942c1d1686f2af42a8a2f3d59d7e1b5afd0922a Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Tue, 28 Jan 2014 15:16:22 -0500 Subject: Add tpage.put() test. --- tpage_test.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tpage_test.go (limited to 'tpage_test.go') diff --git a/tpage_test.go b/tpage_test.go new file mode 100644 index 0000000..d14ebdb --- /dev/null +++ b/tpage_test.go @@ -0,0 +1,35 @@ +package bolt + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +// Ensure that a temporary page can insert a key/value. +func TestTpagePut(t *testing.T) { + p := &tpage{nodes: make(tnodes, 0)} + p.put([]byte("baz"), []byte("2")) + p.put([]byte("foo"), []byte("0")) + p.put([]byte("bar"), []byte("1")) + p.put([]byte("foo"), []byte("3")) + assert.Equal(t, len(p.nodes), 3) + assert.Equal(t, p.nodes[0], tnode{[]byte("bar"), []byte("1")}) + assert.Equal(t, p.nodes[1], tnode{[]byte("baz"), []byte("2")}) + assert.Equal(t, p.nodes[2], tnode{[]byte("foo"), []byte("3")}) +} + +// Ensure that a temporary page can deserialize from a page. +func TestTpageRead(t *testing.T) { + t.Skip("pending") +} + +// Ensure that a temporary page can serialize itself. +func TestTpageWrite(t *testing.T) { + t.Skip("pending") +} + +// Ensure that a temporary page can split into appropriate subgroups. +func TestTpageSplit(t *testing.T) { + t.Skip("pending") +} -- cgit v1.2.3