Skip to content

Commit

Permalink
fix syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
pivilartisant committed Jul 23, 2024
1 parent f1ff906 commit 574d49b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
6 changes: 0 additions & 6 deletions pkg/website/chunk.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
package chunk

import "fmt"

func DivideIntoChunks(data []byte, chunkSize int) [][]byte {
if data == nil || chunkSize <= 0 {
return nil
}

var chunks [][]byte

fmt.Printf("Data: %v\nLength: %v\n", data, len(data))

for i := 0; i < len(data); i += chunkSize {
end := i + chunkSize
if end > len(data) {
Expand All @@ -22,5 +18,3 @@ func DivideIntoChunks(data []byte, chunkSize int) [][]byte {

return chunks
}

// string => byte arr ==> function ==> assert chunk length
4 changes: 2 additions & 2 deletions pkg/website/chunk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ func TestChunk(t *testing.T) {
return
}

expectedChunks := (len(test.data) + test.chunkSize - 1) / test.chunkSize
expectedChunkLen := (len(test.data) + test.chunkSize - 1) / test.chunkSize

assert.Equal(t, len(chunks), expectedChunks)
assert.Equal(t, len(chunks), expectedChunkLen)

})
}
Expand Down

0 comments on commit 574d49b

Please sign in to comment.