overflow_discovery/net/zone_test.go
crusader cb7a0cea64 ing
2017-10-20 18:09:07 +09:00

36 lines
539 B
Go

package net
import (
"log"
"testing"
"git.loafle.net/overflow/overflow_discovery/net/model"
)
func TestScanZone(t *testing.T) {
endChan := make(chan bool)
zoneChan := make(chan *model.DiscoveryZone, 4)
logChan := make(chan error, 4)
defer func() {
close(endChan)
close(zoneChan)
close(logChan)
}()
go ScanZone(endChan, zoneChan, logChan)
Loop:
for {
select {
case zone := <-zoneChan:
log.Printf("zone: %v", zone)
case err := <-logChan:
log.Printf("log: %v", err)
case <-endChan:
break Loop
}
}
}