package pcap

import (
	"fmt"
	"git.loafle.net/overflow/overflow_probe/discovery/core/scan/zone"
	"github.com/stretchr/testify/assert"
	"testing"
)

func TestMapRemove(t *testing.T) {

	m := make(map[string]string, 0)

	m["1"] = "1"
	m["2"] = "2"
	m["3"] = "3"
	assert.Equal(t, 3, len(m))

	delete(m, "1")
	assert.Equal(t, 2, len(m))
}

func TestPcapNewRemove(t *testing.T) {

	z := zone.NewZone()

	GetInstance(z[0])
	assert.Equal(t, 1, len(pcaps))

	Release(z[0])
	assert.Equal(t, 0, len(pcaps))
}

func TestRemoveAll(t *testing.T) {

	z := zone.NewZone()

	GetInstance(z[0])
	fmt.Println("a9se8rypasd")
	assert.Equal(t, 1, len(pcaps))

	RemoveAll()
	fmt.Println("a9se8rypasd")
	assert.Equal(t, 0, len(pcaps))
}
