package main

import (
	"testing"
	"time"
)

func TestSummarize(t *testing.T) {
	summary := summarize([]sample{{latency: 10 * time.Millisecond, status: 200}, {latency: 20 * time.Millisecond, status: 200}, {latency: 100 * time.Millisecond, status: 500}}, time.Second)
	if summary.Requests != 3 || summary.Success != 2 || summary.Errors != 1 {
		t.Fatalf("unexpected counts: %#v", summary)
	}
	if summary.P95MS != 20 {
		t.Fatalf("unexpected p95: %v", summary.P95MS)
	}
}
