MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / TestIterator_EmptyDB

Function TestIterator_EmptyDB

driver/hybriddb/iterator_test.go:91–119  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

89}
90
91func TestIterator_EmptyDB(t *testing.T) {
92 tempDir := t.TempDir()
93 cfg := &config.Config{
94 LevelDB: config.LevelDBConfig{
95 CacheSize: 64 * 1024 * 1024,
96 BlockSize: 4 * 1024,
97 WriteBufferSize: 4 * 1024 * 1024,
98 MaxOpenFiles: 1000,
99 Compression: true,
100 },
101 }
102
103 db, err := Store{}.Open(tempDir, cfg)
104 require.NoError(t, err)
105 defer db.Close()
106
107 iter := db.NewIterator()
108 defer iter.Close()
109
110 // Test with empty database
111 iter.First()
112 assert.False(t, iter.Valid())
113
114 iter.Last()
115 assert.False(t, iter.Valid())
116
117 iter.Seek([]byte("any"))
118 assert.False(t, iter.Valid())
119}
120
121func TestIterator_Close(t *testing.T) {
122 tempDir := t.TempDir()

Callers

nothing calls this directly

Calls 8

CloseMethod · 0.95
FirstMethod · 0.95
ValidMethod · 0.95
LastMethod · 0.95
SeekMethod · 0.95
CloseMethod · 0.65
OpenMethod · 0.45
NewIteratorMethod · 0.45

Tested by

no test coverage detected