aboutsummaryrefslogtreecommitdiff
path: root/tools/ipconverter/main_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'tools/ipconverter/main_test.go')
-rw-r--r--tools/ipconverter/main_test.go43
1 files changed, 0 insertions, 43 deletions
diff --git a/tools/ipconverter/main_test.go b/tools/ipconverter/main_test.go
deleted file mode 100644
index 10d09ab..0000000
--- a/tools/ipconverter/main_test.go
+++ /dev/null
@@ -1,43 +0,0 @@
-package main
-
-import (
- "math/big"
- "testing"
-)
-
-func TestIPtoInt(t *testing.T) {
-
- tests := map[string]*big.Int{
- "192.168.0.1": big.NewInt(3232235521),
- "10.0.0.1": big.NewInt(167772161),
- }
- for test := range tests {
- r, err := IPtoInt(test)
- if err != nil {
- t.Errorf("failed to convert %s to an int: %s", test, err)
- }
- if r.Cmp(tests[test]) != 0 {
- t.Errorf("convert %s to int, got %d expected %d", test, r, tests[test])
- }
- }
-
- if _, err := IPtoInt("10"); err == nil {
- t.Error("calling IPtoInt with invalid IP did not result in error")
- }
-}
-
-func TestIPtoN(t *testing.T) {
- tests := map[string]string{
- "3232235521": "192.168.0.1",
- "167772161": "10.0.0.1",
- }
- for test := range tests {
- r, err := IPtoN(test)
- if err != nil {
- t.Errorf("failed to convert %s to an address: %s", test, err)
- }
- if r != tests[test] {
- t.Errorf("convert %s to address, got %s expected %s", test, r, tests[test])
- }
- }
-}