MCPcopy Index your code
hub / github.com/sourcegraph/checkup / TestComputeStats

Function TestComputeStats

checkup_test.go:84–109  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

82}
83
84func 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
111func TestResultStatus(t *testing.T) {
112 r := types.Result{Healthy: true}

Callers

nothing calls this directly

Calls 1

ComputeStatsMethod · 0.80

Tested by

no test coverage detected