Commit d4a29972 authored by Boris Mühmer's avatar Boris Mühmer
Browse files

minor cleanup

parent 3c247ce7
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -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)
@@ -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
		}
@@ -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)
	}