MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / TestFileHeader_Compact_Merge

Function TestFileHeader_Compact_Merge

internal/utils/bfs/file_header_test.go:144–191  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

142}
143
144func TestFileHeader_Compact_Merge(t *testing.T) {
145 var a = assert.NewAssertion(t)
146
147 var header = &bfs.FileHeader{
148 Version: 1,
149 Status: 200,
150 HeaderBlocks: []bfs.BlockInfo{
151 {
152 BFileOffsetFrom: 1000,
153 BFileOffsetTo: 1100,
154 OriginOffsetFrom: 1200,
155 OriginOffsetTo: 1300,
156 },
157 {
158 BFileOffsetFrom: 1100,
159 BFileOffsetTo: 1200,
160 OriginOffsetFrom: 1300,
161 OriginOffsetTo: 1400,
162 },
163 },
164 BodyBlocks: []bfs.BlockInfo{
165 {
166 BFileOffsetFrom: 0,
167 BFileOffsetTo: 100,
168 OriginOffsetFrom: 200,
169 OriginOffsetTo: 300,
170 },
171 {
172 BFileOffsetFrom: 100,
173 BFileOffsetTo: 200,
174 OriginOffsetFrom: 300,
175 OriginOffsetTo: 400,
176 },
177 {
178 BFileOffsetFrom: 200,
179 BFileOffsetTo: 300,
180 OriginOffsetFrom: 400,
181 OriginOffsetTo: 500,
182 },
183 },
184 }
185 header.Compact()
186 logs.PrintAsJSON(header.HeaderBlocks)
187 logs.PrintAsJSON(header.BodyBlocks)
188
189 a.IsTrue(len(header.HeaderBlocks) == 1)
190 a.IsTrue(len(header.BodyBlocks) == 1)
191}
192
193func TestFileHeader_Compact_Merge2(t *testing.T) {
194 var header = &bfs.FileHeader{

Callers

nothing calls this directly

Calls 1

CompactMethod · 0.45

Tested by

no test coverage detected