(t *testing.T)
| 82 | } |
| 83 | |
| 84 | func TestComputeStats(t *testing.T) { |
| 85 | s := types.Result{Times: []types.Attempt{ |
| 86 | {RTT: 7 * time.Second}, |
| 87 | {RTT: 4 * time.Second}, |
| 88 | {RTT: 4 * time.Second}, |
| 89 | {RTT: 6 * time.Second}, |
| 90 | {RTT: 6 * time.Second}, |
| 91 | {RTT: 3 * time.Second}, |
| 92 | }}.ComputeStats() |
| 93 | |
| 94 | if got, want := s.Total, 30*time.Second; got != want { |
| 95 | t.Errorf("Expected Total=%v, got %v", want, got) |
| 96 | } |
| 97 | if got, want := s.Mean, 5*time.Second; got != want { |
| 98 | t.Errorf("Expected Mean=%v, got %v", want, got) |
| 99 | } |
| 100 | if got, want := s.Median, 5*time.Second; got != want { |
| 101 | t.Errorf("Expected Median=%v, got %v", want, got) |
| 102 | } |
| 103 | if got, want := s.Min, 3*time.Second; got != want { |
| 104 | t.Errorf("Expected Min=%v, got %v", want, got) |
| 105 | } |
| 106 | if got, want := s.Max, 7*time.Second; got != want { |
| 107 | t.Errorf("Expected Max=%v, got %v", want, got) |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | func TestResultStatus(t *testing.T) { |
| 112 | r := types.Result{Healthy: true} |
nothing calls this directly
no test coverage detected