Skip to content

Commit

Permalink
initial tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Chad Robinson committed Jun 13, 2019
1 parent ff30ffc commit d48e45c
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions iid/iid_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package iid

import (
"net"
"testing"
)

var IPTests = []struct {
name string
address string
res bool
}{

{
"NotReserved",
"25:100:200::195:16",
false,
},
{
"ReservedAnycast",
"::",
true,
},
{
"ReservedEthernet",
"0200:5EFF:FE00:521a:AAAA:BBBB:CCCC:DDDD",
true,
},
}

func TestGetReservationsForIP(t *testing.T) {
for _, tt := range IPTests {
ip := net.ParseIP(tt.address)
r := GetReservationsForIP(ip)
if len(r) > 0 && tt.res && len(r) == 0 && tt.res == true {
t.Errorf("%s returned wrong reservations status", tt.name)
}
}
}

0 comments on commit d48e45c

Please sign in to comment.