-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_test.go
32 lines (28 loc) · 1.01 KB
/
main_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package main
import (
"reflect"
"testing"
)
func TestNM(t *testing.T) {
var tests = []struct {
data string
splitWant []string
key string
}{
{"1001640 96 T _x_cgo_callers", []string{"1001640", "96", "T", "_x_cgo_callers"}, "_x_cgo_callers"},
{"16b9450 16 R crypto.statictmp_0", []string{"16b9450", "16", "R", "crypto.statictmp_0"}, "crypto"},
{"113b3e0 208 T crypto/cipher.xorBytes", []string{"113b3e0", "208", "T", "crypto/cipher.xorBytes"}, "crypto"},
{"103cc90 32 T runtime.gcd", []string{"103cc90", "32", "T", "runtime.gcd"}, "runtime"},
{"135ff60 64 T vendor/golang.org/x/net/ipv4.parseTTL", []string{"135ff60", "64", "T", "vendor/golang.org/x/net/ipv4.parseTTL"}, "vendor/golang.org/x/net"},
}
for _, test := range tests {
ss := split(test.data)
if !reflect.DeepEqual(ss, test.splitWant) {
t.Errorf("want: %v, got: %v", test.splitWant, ss)
}
key := keygen(ss[3], 2)
if key != test.key {
t.Errorf("want: %v, got: %v", test.key, key)
}
}
}