Loading tickets/tickets_test.go +4 −5 Original line number Diff line number Diff line Loading @@ -62,9 +62,8 @@ func TestTicketsComplex(t *testing.T) { t.Logf("numWorkers: %d", numWorkers) // gernerate some work processDuration := time.Duration(0) var ticketStream chan *Ticket ticketStream = make(chan *Ticket, numBuffered) totalProcessDuration := time.Duration(0) ticketStream := make(chan *Ticket, numBuffered) go func(numTickets int) { defer func() { close(ticketStream) Loading @@ -75,7 +74,7 @@ func TestTicketsComplex(t *testing.T) { //d := 200 * time.Millisecond d := time.Duration(100+rand.Int63n(400)) * time.Millisecond ticket := NewTicket(i, d) processDuration += d totalProcessDuration += d t.Logf("prepared ticket: %d / %s", ticket.ID, ticket.Duration.String()) ticketStream <- ticket } Loading Loading @@ -124,7 +123,7 @@ func TestTicketsComplex(t *testing.T) { t.Logf("worker %d processed %d", i.ID, i.Count) processedTickets += i.Count } t.Logf("processed tickets: %d - process duration: %s", processedTickets, processDuration.String()) t.Logf("processed tickets: %d - process duration: %s", processedTickets, totalProcessDuration.String()) if maxTickets != processedTickets { t.Errorf("the count of processed tickets is %d, expected %d", processedTickets, maxTickets) } Loading Loading
tickets/tickets_test.go +4 −5 Original line number Diff line number Diff line Loading @@ -62,9 +62,8 @@ func TestTicketsComplex(t *testing.T) { t.Logf("numWorkers: %d", numWorkers) // gernerate some work processDuration := time.Duration(0) var ticketStream chan *Ticket ticketStream = make(chan *Ticket, numBuffered) totalProcessDuration := time.Duration(0) ticketStream := make(chan *Ticket, numBuffered) go func(numTickets int) { defer func() { close(ticketStream) Loading @@ -75,7 +74,7 @@ func TestTicketsComplex(t *testing.T) { //d := 200 * time.Millisecond d := time.Duration(100+rand.Int63n(400)) * time.Millisecond ticket := NewTicket(i, d) processDuration += d totalProcessDuration += d t.Logf("prepared ticket: %d / %s", ticket.ID, ticket.Duration.String()) ticketStream <- ticket } Loading Loading @@ -124,7 +123,7 @@ func TestTicketsComplex(t *testing.T) { t.Logf("worker %d processed %d", i.ID, i.Count) processedTickets += i.Count } t.Logf("processed tickets: %d - process duration: %s", processedTickets, processDuration.String()) t.Logf("processed tickets: %d - process duration: %s", processedTickets, totalProcessDuration.String()) if maxTickets != processedTickets { t.Errorf("the count of processed tickets is %d, expected %d", processedTickets, maxTickets) } Loading