mirror of
https://github.com/golang/net.git
synced 2026-04-01 02:47:08 +09:00
internal/quic: use slices.Equal in TestAcksSent
The module go.mod uses go 1.18 and acks_test.go has a go:build go1.21 tag. Change-Id: Ic0785bcb4795bedecc6a752f5e67a967851237e6 Reviewed-on: https://go-review.googlesource.com/c/net/+/565137 Reviewed-by: Than McIntosh <thanm@google.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
committed by
Gopher Robot
parent
dda3687b19
commit
cc568eace4
@@ -7,6 +7,7 @@
|
||||
package quic
|
||||
|
||||
import (
|
||||
"slices"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
@@ -198,7 +199,7 @@ func TestAcksSent(t *testing.T) {
|
||||
if len(gotNums) == 0 {
|
||||
wantDelay = 0
|
||||
}
|
||||
if !slicesEqual(gotNums, test.wantAcks) || gotDelay != wantDelay {
|
||||
if !slices.Equal(gotNums, test.wantAcks) || gotDelay != wantDelay {
|
||||
t.Errorf("acks.acksToSend(T+%v) = %v, %v; want %v, %v", delay, gotNums, gotDelay, test.wantAcks, wantDelay)
|
||||
}
|
||||
}
|
||||
@@ -206,20 +207,6 @@ func TestAcksSent(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// slicesEqual reports whether two slices are equal.
|
||||
// Replace this with slices.Equal once the module go.mod is go1.17 or newer.
|
||||
func slicesEqual[E comparable](s1, s2 []E) bool {
|
||||
if len(s1) != len(s2) {
|
||||
return false
|
||||
}
|
||||
for i := range s1 {
|
||||
if s1[i] != s2[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func TestAcksDiscardAfterAck(t *testing.T) {
|
||||
acks := ackState{}
|
||||
now := time.Now()
|
||||
|
||||
Reference in New Issue
Block a user