-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddress_gostring_test.go
55 lines (38 loc) · 958 Bytes
/
address_gostring_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
51
52
53
54
55
package finger_test
import (
"github.com/reiver/go-finger"
"testing"
)
func TestAddress_GoString(t *testing.T) {
tests := []struct{
Address finger.Address
Expected string
}{
{
Address: finger.CreateAddress("example.com", 1971),
Expected: `finger.CreateAddress("example.com", 1971)`,
},
{
Address: finger.CreateAddressHost("example.com"),
Expected: `finger.CreateAddressHost("example.com")`,
},
{
Address: finger.CreateAddressPort(1971),
Expected: `finger.CreateAddressPort(1971)`,
},
{
Address: finger.EmptyAddress(),
Expected: `finger.EmptyAddress()`,
},
}
for testNumber, test := range tests {
var expected string = test.Expected
var actual string = test.Address.GoString()
if expected != actual {
t.Errorf("For test #%d, the actual value is not what was expected.", testNumber)
t.Logf("EXPECTED: %q", expected)
t.Logf("ACTUAL: %q", actual)
continue
}
}
}