(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func 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 | |
| 40 | func TestDecodeLogRecord(t *testing.T) { |
| 41 | headerBuf := []byte{98, 201, 3, 114, 0, 8, 10} |
nothing calls this directly
no test coverage detected