summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-07-17 12:31:02 -0300
committerEuAndreh <eu@euandre.org>2024-07-17 12:31:02 -0300
commit256e16b04802b4600cee00c39fbad26d1af3ab06 (patch)
tree1cd40dc5e0caf59eb53e99158939e67090c1fff1 /tests
parentsrc/lib.go, tests/lib_test.go: Normaline function argument declarations (diff)
downloadpapod-256e16b04802b4600cee00c39fbad26d1af3ab06.tar.gz
papod-256e16b04802b4600cee00c39fbad26d1af3ab06.tar.xz
Tweak indentation
Diffstat (limited to 'tests')
-rw-r--r--tests/lib_test.go227
1 files changed, 108 insertions, 119 deletions
diff --git a/tests/lib_test.go b/tests/lib_test.go
index 5ca6fce..cfff3b3 100644
--- a/tests/lib_test.go
+++ b/tests/lib_test.go
@@ -5,9 +5,9 @@ import (
"bytes"
"crypto/sha1"
"crypto/sha256"
+ "database/sql"
"encoding/base64"
"encoding/json"
- "database/sql"
"errors"
"fmt"
"hash"
@@ -96,7 +96,7 @@ var sha1TestVectors = []pbkdfTestVector {
"password",
"salt",
2,
- []byte{
+ []byte {
0xea, 0x6c, 0x01, 0x4d, 0xc7, 0x2d, 0x6f, 0x8c,
0xcd, 0x1e, 0xd9, 0x2a, 0xce, 0x1d, 0x41, 0xf0,
0xd8, 0xde, 0x89, 0x57,
@@ -106,7 +106,7 @@ var sha1TestVectors = []pbkdfTestVector {
"password",
"salt",
4096,
- []byte{
+ []byte {
0x4b, 0x00, 0x79, 0x01, 0xb7, 0x65, 0x48, 0x9a,
0xbe, 0xad, 0x49, 0xd9, 0x26, 0xf7, 0x21, 0xd0,
0x65, 0xa4, 0x29, 0xc1,
@@ -129,7 +129,7 @@ var sha1TestVectors = []pbkdfTestVector {
"passwordPASSWORDpassword",
"saltSALTsaltSALTsaltSALTsaltSALTsalt",
4096,
- []byte{
+ []byte {
0x3d, 0x2e, 0xec, 0x4f, 0xe4, 0x1c, 0x84, 0x9b,
0x80, 0xc8, 0xd8, 0x36, 0x62, 0xc0, 0xe4, 0x4a,
0x8b, 0x29, 0x1a, 0x96, 0x4c, 0xf2, 0xf0, 0x70,
@@ -140,7 +140,7 @@ var sha1TestVectors = []pbkdfTestVector {
"pass\000word",
"sa\000lt",
4096,
- []byte{
+ []byte {
0x56, 0xfa, 0x6a, 0xa7, 0x55, 0x48, 0x09, 0x9d,
0xcc, 0x37, 0xd7, 0xf0, 0x34, 0x25, 0xe0, 0xc3,
},
@@ -335,7 +335,7 @@ var good = []scryptTestVector {
{
"pleaseletmein", "SodiumChloride",
1048576, 8, 1,
- []byte{
+ []byte {
0x21, 0x01, 0xcb, 0x9b, 0x6a, 0x51, 0x1a, 0xae, 0xad,
0xdb, 0xbe, 0x09, 0xcf, 0x70, 0xf8, 0x81, 0xec, 0x56,
0x8d, 0x57, 0x4a, 0x2f, 0xfd, 0x4d, 0xab, 0xe5, 0xee,
@@ -388,7 +388,7 @@ func TestExample(t *testing.T) {
const expected = "lGnMz8io0AUkfzn6Pls1qX20Vs7PGN6sbYQ2TQgY12M="
// DO NOT use this salt value; generate your own random salt. 8 bytes is
// a good length.
- salt := []byte{0xc8, 0x28, 0xf2, 0x58, 0xa7, 0x6a, 0xad, 0x7b}
+ salt := []byte {0xc8, 0x28, 0xf2, 0x58, 0xa7, 0x6a, 0xad, 0x7b}
dk, err := papod.Scrypt([]byte("some password"), salt, 1<<15, 8, 1, 32)
if err != nil {
@@ -679,136 +679,125 @@ func TestParseMessage(t *testing.T) {
input string
expected papod.Message
}
- tableOK := []tableTOK {
- {
- "NICK joebloe ",
- papod.Message {
- Prefix: "",
- Command: "NICK",
- Params: papod.MessageParams {
- Middle: []string { "joebloe" },
- Trailing: "",
- },
- Raw: "NICK joebloe ",
+ tableOK := []tableTOK {{
+ "NICK joebloe ",
+ papod.Message {
+ Prefix: "",
+ Command: "NICK",
+ Params: papod.MessageParams {
+ Middle: []string { "joebloe" },
+ Trailing: "",
},
+ Raw: "NICK joebloe ",
},
- {
- "USER joebloe 0.0.0.0 joe :Joe Bloe",
- papod.Message {
- Prefix: "",
- Command: "USER",
- Params: papod.MessageParams {
- Middle: []string {
- "joebloe", "0.0.0.0", "joe",
- },
- Trailing: "Joe Bloe",
+ }, {
+ "USER joebloe 0.0.0.0 joe :Joe Bloe",
+ papod.Message {
+ Prefix: "",
+ Command: "USER",
+ Params: papod.MessageParams {
+ Middle: []string {
+ "joebloe", "0.0.0.0", "joe",
},
- Raw: "USER joebloe 0.0.0.0 joe :Joe Bloe",
- },
- },
- {
- ":pre USER joebloe 0.0.0.0 joe :Joe Bloe",
- papod.Message {
- Prefix: "pre",
- Command: "USER",
- Params: papod.MessageParams {
- Middle: []string {
- "joebloe", "0.0.0.0", "joe",
- },
- Trailing: "Joe Bloe",
+ Trailing: "Joe Bloe",
+ },
+ Raw: "USER joebloe 0.0.0.0 joe :Joe Bloe",
+ },
+ }, {
+ ":pre USER joebloe 0.0.0.0 joe :Joe Bloe",
+ papod.Message {
+ Prefix: "pre",
+ Command: "USER",
+ Params: papod.MessageParams {
+ Middle: []string {
+ "joebloe", "0.0.0.0", "joe",
},
- Raw: ":pre USER joebloe 0.0.0.0 joe :Joe Bloe",
- },
- },
- {
- ":pre USER joebloe 0.0.0.0 joe : Joe Bloe ",
- papod.Message {
- Prefix: "pre",
- Command: "USER",
- Params: papod.MessageParams {
- Middle: []string {
- "joebloe", "0.0.0.0", "joe",
- },
- Trailing: " Joe Bloe ",
+ Trailing: "Joe Bloe",
+ },
+ Raw: ":pre USER joebloe 0.0.0.0 joe :Joe Bloe",
+ },
+ }, {
+ ":pre USER joebloe 0.0.0.0 joe : Joe Bloe ",
+ papod.Message {
+ Prefix: "pre",
+ Command: "USER",
+ Params: papod.MessageParams {
+ Middle: []string {
+ "joebloe", "0.0.0.0", "joe",
},
- Raw: ":pre USER joebloe 0.0.0.0 joe : Joe Bloe ",
- },
- },
- {
- ":pre USER joebloe: 0:0:0:0 joe::a: : Joe Bloe ",
- papod.Message {
- Prefix: "pre",
- Command: "USER",
- Params: papod.MessageParams {
- Middle: []string {
- "joebloe:", "0:0:0:0", "joe::a:",
- },
- Trailing: " Joe Bloe ",
+ Trailing: " Joe Bloe ",
+ },
+ Raw: ":pre USER joebloe 0.0.0.0 joe : Joe Bloe ",
+ },
+ }, {
+ ":pre USER joebloe: 0:0:0:1 joe::a: : Joe Bloe ",
+ papod.Message {
+ Prefix: "pre",
+ Command: "USER",
+ Params: papod.MessageParams {
+ Middle: []string {
+ "joebloe:", "0:0:0:1", "joe::a:",
},
- Raw: ":pre USER joebloe: 0:0:0:0 joe::a: : Joe Bloe ",
+ Trailing: " Joe Bloe ",
},
+ Raw: ":pre USER joebloe: 0:0:0:1 joe::a: : Joe Bloe ",
},
- {
- ":pre USER :Joe Bloe",
- papod.Message {
- Prefix: "pre",
- Command: "USER",
- Params: papod.MessageParams {
- Middle: []string { },
- Trailing: "Joe Bloe",
- },
- Raw: ":pre USER :Joe Bloe",
+ }, {
+ ":pre USER :Joe Bloe",
+ papod.Message {
+ Prefix: "pre",
+ Command: "USER",
+ Params: papod.MessageParams {
+ Middle: []string { },
+ Trailing: "Joe Bloe",
},
+ Raw: ":pre USER :Joe Bloe",
},
- {
- ":pre USER : Joe Bloe",
- papod.Message {
- Prefix: "pre",
- Command: "USER",
- Params: papod.MessageParams {
- Middle: []string { },
- Trailing: " Joe Bloe",
- },
- Raw: ":pre USER : Joe Bloe",
+ }, {
+ ":pre USER : Joe Bloe",
+ papod.Message {
+ Prefix: "pre",
+ Command: "USER",
+ Params: papod.MessageParams {
+ Middle: []string { },
+ Trailing: " Joe Bloe",
},
+ Raw: ":pre USER : Joe Bloe",
},
- {
- ":pre USER : Joe Bloe",
- papod.Message {
- Prefix: "pre",
- Command: "USER",
- Params: papod.MessageParams {
- Middle: []string { },
- Trailing: " Joe Bloe",
- },
- Raw: ":pre USER : Joe Bloe",
+ }, {
+ ":pre USER : Joe Bloe",
+ papod.Message {
+ Prefix: "pre",
+ Command: "USER",
+ Params: papod.MessageParams {
+ Middle: []string { },
+ Trailing: " Joe Bloe",
},
+ Raw: ":pre USER : Joe Bloe",
},
- {
- ":pre USER : ",
- papod.Message {
- Prefix: "pre",
- Command: "USER",
- Params: papod.MessageParams {
- Middle: []string { },
- Trailing: " ",
- },
- Raw: ":pre USER : ",
+ }, {
+ ":pre USER : ",
+ papod.Message {
+ Prefix: "pre",
+ Command: "USER",
+ Params: papod.MessageParams {
+ Middle: []string { },
+ Trailing: " ",
},
+ Raw: ":pre USER : ",
},
- {
- ":pre USER :",
- papod.Message {
- Prefix: "pre",
- Command: "USER",
- Params: papod.MessageParams {
- Middle: []string { },
- Trailing: "",
- },
- Raw: ":pre USER :",
+ }, {
+ ":pre USER :",
+ papod.Message {
+ Prefix: "pre",
+ Command: "USER",
+ Params: papod.MessageParams {
+ Middle: []string { },
+ Trailing: "",
},
+ Raw: ":pre USER :",
},
- }
+ }}
for i, entry := range tableOK {
given, err := papod.ParseMessage(entry.input)