mirror of
https://github.com/safing/structures
synced 2025-04-04 17:39:12 +00:00
29 lines
573 B
Go
29 lines
573 B
Go
package dsd
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestSafeFirst16(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
assert.Equal(t,
|
|
"47 6f 20 69 73 20 61 6e 20 6f 70 65 6e 20 73 6f |Go is an open so|",
|
|
safeFirst16Bytes([]byte("Go is an open source programming language.")),
|
|
)
|
|
assert.Equal(t,
|
|
"47 6f 20 69 73 20 61 6e 20 6f 70 65 6e 20 73 6f |Go is an open so|",
|
|
safeFirst16Chars("Go is an open source programming language."),
|
|
)
|
|
|
|
assert.Equal(t,
|
|
"<empty>",
|
|
safeFirst16Bytes(nil),
|
|
)
|
|
assert.Equal(t,
|
|
"<empty>",
|
|
safeFirst16Chars(""),
|
|
)
|
|
}
|