| 75 | } |
| 76 | |
| 77 | func TestHintEntrySize(t *testing.T) { |
| 78 | entry := &HintEntry{ |
| 79 | BucketId: 1, |
| 80 | KeySize: 3, |
| 81 | ValueSize: 5, |
| 82 | Timestamp: 1234567890, |
| 83 | TTL: 3600, |
| 84 | Flag: DataSetFlag, |
| 85 | Status: Committed, |
| 86 | Ds: DataStructureBTree, |
| 87 | DataPos: 100, |
| 88 | FileID: 1, |
| 89 | Key: []byte("key"), |
| 90 | } |
| 91 | |
| 92 | expectedSize := entry.Size() |
| 93 | encoded := entry.Encode() |
| 94 | actualSize := int64(len(encoded)) |
| 95 | |
| 96 | if expectedSize != actualSize { |
| 97 | t.Errorf("Expected size %d, got %d", expectedSize, actualSize) |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | func TestHintEntryEncodeDecodeEdgeCases(t *testing.T) { |
| 102 | testCases := []struct { |