🚧 Add Defrag function
This commit is contained in:
parent
2f165369cc
commit
932e8e2f11
7 changed files with 136 additions and 1 deletions
19
defrag_test.go
Normal file
19
defrag_test.go
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package defrag
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestDefrag(t *testing.T) {
|
||||
for _, testcase := range sampleTests() {
|
||||
t.Run(testcase.name, func(sub *testing.T) {
|
||||
blocks := make([]byte, len(testcase.blocks))
|
||||
copy(blocks, testcase.blocks)
|
||||
err := Defrag(blocks)
|
||||
require.NoError(sub, err)
|
||||
require.Equal(sub, testcase.defragged, blocks)
|
||||
})
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue