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

Function TestGetLogRecordCRC

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

Source from the content-addressed store, hash-verified

68}
69
70func TestGetLogRecordCRC(t *testing.T) {
71 record1 := &LogRecord{
72 Key: []byte("name"),
73 Value: []byte("flydb"),
74 Type: LogRecordNormal,
75 }
76 headerBuf := []byte{98, 201, 3, 114, 0, 8, 10}
77 crc := getLogRecordCRC(record1, headerBuf[crc32.Size:])
78 assert.Equal(t, uint32(1912850786), crc)
79
80 record2 := &LogRecord{
81 Key: []byte("name"),
82 Type: LogRecordNormal,
83 }
84 headerBuf2 := []byte{9, 252, 88, 14, 0, 8, 0}
85 crc2 := getLogRecordCRC(record2, headerBuf2[crc32.Size:])
86 assert.Equal(t, uint32(240712713), crc2)
87
88 record3 := &LogRecord{
89 Key: []byte("name"),
90 Value: []byte("flydb"),
91 Type: LogRecordDeleted,
92 }
93 headerBuf3 := []byte{13, 133, 166, 233, 1, 8, 10}
94 crc3 := getLogRecordCRC(record3, headerBuf3[crc32.Size:])
95 assert.Equal(t, uint32(3920004365), crc3)
96
97}

Callers

nothing calls this directly

Calls 1

getLogRecordCRCFunction · 0.85

Tested by

no test coverage detected