-
Notifications
You must be signed in to change notification settings - Fork 7
/
buffer_list_test.go
52 lines (43 loc) · 1008 Bytes
/
buffer_list_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package tiledb
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func ExampleNewBufferList() {
// Create context with default config
context, err := NewContext(nil)
if err != nil {
// Handle error
return
}
// Create BufferList
bufferList, err := NewBufferList(context)
if err != nil {
// Handle error
return
}
// Get num buffers
numBuffers, err := bufferList.NumBuffers()
if err != nil {
// Handle error
return
}
fmt.Println(numBuffers)
// Output: 0
}
// TestNewBufferList tests creating a new bufferList
func TestNewBufferList(t *testing.T) {
context, err := NewContext(nil)
require.NoError(t, err)
bufferList, err := NewBufferList(context)
require.NoError(t, err)
assert.NotNil(t, bufferList)
numBuffers, err := bufferList.NumBuffers()
require.NoError(t, err)
assert.Equal(t, uint64(0), numBuffers)
totalSize, err := bufferList.TotalSize()
require.NoError(t, err)
assert.Equal(t, uint64(0), totalSize)
}