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

added sum of all ticket durations

parent 8bee2ce2
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ 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)
	go func(numTickets int) {
@@ -74,6 +75,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
			t.Logf("prepared ticket: %d / %s", ticket.ID, ticket.Duration.String())
			ticketStream <- ticket
		}
@@ -122,7 +124,7 @@ func TestTicketsComplex(t *testing.T) {
		t.Logf("worker %d processed %d", i.ID, i.Count)
		processedTickets += i.Count
	}
	t.Logf("processed tickets: %d", processedTickets)
	t.Logf("processed tickets: %d - process duration: %s", processedTickets, processDuration.String())
	if maxTickets != processedTickets {
		t.Errorf("the count of processed tickets is %d, expected %d", processedTickets, maxTickets)
	}