Skip to content
This repository was archived by the owner on Jul 22, 2024. It is now read-only.
This repository was archived by the owner on Jul 22, 2024. It is now read-only.

function Difference test failed #17

@AirbornWdd

Description

@AirbornWdd
func TestIPSetDiff(t *testing.T) {
	var testAddrSet = []string{
		"10.1.1.0",
		"10.1.1.5",
		"10.1.1.6",
		"10.1.1.7",
		"10.1.1.8",
		"10.1.1.9",
		"10.1.1.10",
		"10.1.1.1",
		"10.1.1.2",
		"10.1.1.3",
		"10.1.1.4",
		"10.1.1.11",
		"10.1.1.12",
		"10.1.1.13",
		"10.1.1.14",
		"10.1.1.15",
	}

	n := &netaddr.IPSet{}
	o := &netaddr.IPSet{}

	_, ips, _ := net.ParseCIDR("10.1.1.0/28")
	n.InsertNet(ips)

	for _, ip := range testAddrSet {
		o.Insert(net.ParseIP(ip))
	}

	if d := n.Difference(o).String(); len(d) != 0 {
		t.Fatalf("diff: %s", d)
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions