aboutsummaryrefslogtreecommitdiff
path: root/dht/krpc_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'dht/krpc_test.go')
-rw-r--r--dht/krpc_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/dht/krpc_test.go b/dht/krpc_test.go
new file mode 100644
index 0000000..d710678
--- /dev/null
+++ b/dht/krpc_test.go
@@ -0,0 +1,25 @@
+package dht
+
+import (
+ "testing"
+)
+
+func TestStringToCompactNodeInfo(t *testing.T) {
+
+ tests := []struct {
+ in string
+ out []byte
+ }{
+ {in: "192.168.1.1:6881", out: []byte("asdfasdf")},
+ }
+
+ for _, tt := range tests {
+ r, err := stringToCompactNodeInfo(tt.in)
+ if err != nil {
+ t.Errorf("stringToCompactNodeInfo failed with %s", err)
+ }
+ if r != tt.out {
+ t.Errorf("stringToCompactNodeInfo(%s) => %s, expected %s", tt.in, r, tt.out)
+ }
+ }
+}