forked from mrichman/godnsbl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
godnsbl_test.go
50 lines (39 loc) · 966 Bytes
/
godnsbl_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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package godnsbl
import (
"fmt"
"net"
"testing"
)
// Parallel for loop: https://play.golang.org/p/MVFwbmxbou
// http://www.golangpatterns.info/concurrency/parallel-for-loop
func TestReverseIP(t *testing.T) {
fmt.Println("TestReverseIP")
t.Parallel()
ip := net.IP{192, 168, 1, 1}
r := Reverse(ip)
if r != "1.1.168.192" {
t.Errorf("Expected ip to equal 1.1.168.192, actual %v", r)
}
}
func TestKnownIP(t *testing.T) {
fmt.Println("TestKnownIP")
t.Parallel()
for i := range Blacklists {
res := Lookup(Blacklists[i], "127.0.0.2")
fmt.Println(res.Results)
}
}
func TestLookupParams(t *testing.T) {
fmt.Println("TestLookupParams")
t.Parallel()
for i := range Blacklists {
res := Lookup(Blacklists[i], "127.0.0.2")
//fmt.Println(res.Results)
if res.List != Blacklists[i] {
t.Errorf("Expected %v, actual %v", Blacklists[i], res.List)
}
if res.Host != "127.0.0.2" {
t.Errorf("Expected 127.0.0.2, actual %v", res.Host)
}
}
}