(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestToDecimal(t *testing.T) { |
| 10 | var msb = new(big.Int) |
| 11 | msb, _ = msb.SetString("80000000000000000000000000000000", 16) |
| 12 | |
| 13 | var tests = []struct { |
| 14 | in string |
| 15 | out *big.Int |
| 16 | }{ |
| 17 | {"127.0.0.1", big.NewInt(2130706433)}, |
| 18 | {"::1", big.NewInt(1)}, |
| 19 | {"8000::", msb}, |
| 20 | } |
| 21 | for _, tt := range tests { |
| 22 | i := ToDecimal(net.ParseIP(tt.in)) |
| 23 | if tt.out.Cmp(i) != 0 { |
| 24 | t.Errorf("Expected %d, got %d for IP %s", tt.out, i, tt.in) |
| 25 | } |
| 26 | } |
| 27 | } |
nothing calls this directly
no test coverage detected