func TestFreeLeaseMatch(t *testing.T) {
	dt, s := simpleSetup()
	s.Leases["one"] = &Lease{}
	s.Leases["two"] = &Lease{
		Ip: s.ActiveStart,
	}
	s.ActiveBits.Set(0)
	s.free_lease(dt, "two")
	assert.NotNil(t, s.Leases["one"], "Lease one should not be nil")
	assert.Nil(t, s.Leases["two"], "Lease two should be nil")
	assert.False(t, s.ActiveBits.Test(0), "First bit should be false")
}
Freeing a lease should clear a set ActiveBit if in range
package main
import (
	"github.com/stretchr/testify/assert"
	"github.com/willf/bitset"
	"testing"
)
func TestNewSubnet(t *testing.T) {
	subnet := NewSubnet()
	assert.NotNil(t, subnet.Leases, "Leases must not be nil")
	assert.NotNil(t, subnet.Bindings, "Bindings must not be nil")
	assert.NotNil(t, subnet.Options, "Options must not be nil")
	assert.NotNil(t, subnet.ActiveBits, "ActiveBits must not be nil")
}
func TestMarshalJsonSubnet(t *testing.T) {
	_, s := simpleSetup()
	as := convertSubnetToApiSubnet(s)
	s2, _ := convertApiSubnetToSubnet(as, nil)
	b, e := s2.MarshalJSON()
	assert.Nil(t, e, "Error should be nil")
	s3 := &Subnet{}
	e3 := s3.UnmarshalJSON(b)
	assert.Nil(t, e3, "Error should be nil")
	assert.Equal(t, s3, s2, "Subnet should be equal")
}
func TestFreeLeaseNoMatch(t *testing.T) {
	dt, s := simpleSetup()
	s.Leases["one"] = &Lease{}
	s.free_lease(dt, "two")
	assert.NotNil(t, s.Leases["one"], "Lease one should not be nil")
	assert.Nil(t, s.Leases["two"], "Lease two should be nil")
}