(t *testing.T)
| 135 | } |
| 136 | |
| 137 | func TestRankSNIsKeepsOnlyOK(t *testing.T) { |
| 138 | in := []Result{ |
| 139 | {SNI: "a", Outcome: OutcomeOK, Handshake: 100 * time.Millisecond}, |
| 140 | {SNI: "b", Outcome: OutcomeDPIReset}, |
| 141 | {SNI: "c", Outcome: OutcomeOK, Handshake: 50 * time.Millisecond}, |
| 142 | {SNI: "d", Outcome: OutcomeOK, Handshake: 200 * time.Millisecond}, |
| 143 | } |
| 144 | ranked := RankSNIs(in) |
| 145 | if len(ranked) != 3 { |
| 146 | t.Fatalf("len: %d want 3", len(ranked)) |
| 147 | } |
| 148 | if ranked[0].SNI != "c" || ranked[1].SNI != "a" || ranked[2].SNI != "d" { |
| 149 | t.Fatalf("order: %+v", ranked) |
| 150 | } |
| 151 | } |
nothing calls this directly
no test coverage detected