forked from rchunping/TcpRoute2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrconn_test.go
35 lines (28 loc) · 1.04 KB
/
errconn_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
33
34
35
package main
import (
"testing"
)
func TestErrConn(t *testing.T) {
e := NewErrConnService()
e.AddErrLog("d1", "www.163.com:80", "1.2.3.4:80", ErrConnTypeRead0)
e.AddErrLog("d2", "www.163.com:80", "1.2.3.5:80", ErrConnTypeRead0)
e.AddErrLog("d3", "www.163.com:80", "1.2.3.6:80", ErrConnTypeRead0)
e.AddErrLog("d3", "www.163.com:80", "1.2.3.4:80", ErrConnTypeRead0)
e.AddErrLog("d3", "www.163.com:80", "1.2.3.4:80", ErrConnTypeRead0)
e.AddErrLog("d3", "www.163.com:80", "1.2.3.4:80", ErrConnTypeRead0)
e.AddErrLog("d3", "www.163.com:80", "1.2.3.4:80", ErrConnTypeRead0)
e.AddErrLog("d4", "www.163.com:80", "www.163.com:80", ErrConnTypeRead0)
e.AddErrLog("d5", "www.163.com:80", "www.163.com:80", ErrConnTypeRead0)
if e.Check("d1", "www.163.com:80", "1.2.3.4:80") != false {
t.Error("错误")
}
if e.Check("d3", "www.163.com:80", "1.2.3.0:80") != false {
t.Error("错误")
}
if e.Check("d5", "www.163.com:80", "1.2.3.0:80") != true {
t.Error("错误")
}
if e.Check("d6", "www.163.com:80", "www.163.com:80") != true {
t.Error("错误")
}
}