MCPcopy Create free account
hub / github.com/ByteStorage/FlyDB / TestEncodeLogRecord

Function TestEncodeLogRecord

engine/data/log_record_test.go:9–38  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestEncodeLogRecord(t *testing.T) {
10 // Normal condition
11 record1 := &LogRecord{
12 Key: []byte("name"),
13 Value: []byte("flydb"),
14 Type: LogRecordNormal,
15 }
16 buf1, size := EncodeLogRecord(record1)
17 assert.NotNil(t, buf1)
18 assert.Greater(t, size, int64(5))
19
20 // value is null
21 record2 := &LogRecord{
22 Key: []byte("name"),
23 Type: LogRecordNormal,
24 }
25 buf2, size2 := EncodeLogRecord(record2)
26 assert.NotNil(t, buf2)
27 assert.Greater(t, size2, int64(5))
28
29 // Deleted condition
30 record3 := &LogRecord{
31 Key: []byte("name"),
32 Value: []byte("flydb"),
33 Type: LogRecordDeleted,
34 }
35 buf3, size3 := EncodeLogRecord(record3)
36 assert.NotNil(t, buf3)
37 assert.Greater(t, size3, int64(5))
38}
39
40func TestDecodeLogRecord(t *testing.T) {
41 headerBuf := []byte{98, 201, 3, 114, 0, 8, 10}

Callers

nothing calls this directly

Calls 1

EncodeLogRecordFunction · 0.85

Tested by

no test coverage detected