test decoding on windows
@@ -6,18 +6,29 @@ import (
"testing"
)
-func bufWithBase(base string) *bytes.Buffer {
+func bufWithBase(base string, windows bool) *bytes.Buffer {
b := &bytes.Buffer{}
b.Write(pathPSKv1)
+ if windows {
+ b.WriteString("\r")
+ }
b.WriteString("\n")
b.WriteString(base)
+ if windows {
+ b.WriteString("\r")
+ }
b.WriteString("\n")
return b
}
func TestDecodeHex(t *testing.T) {
- b := bufWithBase("/base16/")
+ testDecodeHex(t, true)
+ testDecodeHex(t, false)
+}
+
+func testDecodeHex(t *testing.T, windows bool) {
+ b := bufWithBase("/base16/", windows)
for i := 0; i < 32; i++ {
b.WriteString("FF")
}
@@ -35,7 +46,12 @@ func TestDecodeHex(t *testing.T) {
}
func TestDecodeB64(t *testing.T) {
- b := bufWithBase("/base64/")
+ testDecodeB64(t, true)
+ testDecodeB64(t, false)
+}
+
+func testDecodeB64(t *testing.T, windows bool) {
+ b := bufWithBase("/base64/", windows)
key := make([]byte, 32)
for i := 0; i < 32; i++ {
key[i] = byte(i)
