Skip to content

Commit

Permalink
localstore: add tests for engine.MultiSeek
Browse files Browse the repository at this point in the history
  • Loading branch information
disksing committed Dec 21, 2015
1 parent 9bc1ea2 commit 56a19f4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions store/localstore/boltdb/boltdb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,14 @@ func (s *testSuite) TestDB(c *C) {
c.Assert(err, NotNil)
c.Assert(k, IsNil)
c.Assert(v, IsNil)

m := db.MultiSeek([][]byte{[]byte("z"), []byte("a"), []byte("a1")})
c.Assert(m, HasLen, 3)
c.Assert(m[0].Err, NotNil)
c.Assert(m[1].Err, IsNil)
c.Assert(m[1].Key, BytesEquals, []byte("a"))
c.Assert(m[1].Value, BytesEquals, []byte("1"))
c.Assert(m[2].Err, IsNil)
c.Assert(m[2].Key, BytesEquals, []byte("b"))
c.Assert(m[2].Value, BytesEquals, []byte("2"))
}
10 changes: 10 additions & 0 deletions store/localstore/goleveldb/goleveldb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,14 @@ func (s *testSuite) TestDB(c *C) {
c.Assert(err, NotNil)
c.Assert(k, IsNil)
c.Assert(v, IsNil)

m := db.MultiSeek([][]byte{[]byte("z"), []byte("a"), []byte("a1")})
c.Assert(m, HasLen, 3)
c.Assert(m[0].Err, NotNil)
c.Assert(m[1].Err, IsNil)
c.Assert(m[1].Key, BytesEquals, []byte("a"))
c.Assert(m[1].Value, BytesEquals, []byte("2"))
c.Assert(m[2].Err, IsNil)
c.Assert(m[2].Key, BytesEquals, []byte("b"))
c.Assert(m[2].Value, BytesEquals, []byte("2"))
}

0 comments on commit 56a19f4

Please sign in to comment.