package traceroute

import (
	"fmt"
	"testing"
)

func TestTracerouteAsync(t *testing.T) {

	c := make(chan Hop, 0)

	go func() {
		for {
			hop, ok := <-c
			if !ok {
				fmt.Println()
				return
			}
			t.Logf("%d. %v - %v\n", hop.TTL, AddressToString(hop.Address), hop.ElapsedTime)

		}
	}()

	err := Traceroute("216.58.197.228", c)
	if err != nil {
		t.Error(err)
	}
}
