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>
diff --git a/internal/quic/acks_test.go b/internal/quic/acks_test.go
index 4f10329..d10f917 100644
--- a/internal/quic/acks_test.go
+++ b/internal/quic/acks_test.go
@@ -7,6 +7,7 @@
package quic
import (
+ "slices"
"testing"
"time"
)
@@ -198,7 +199,7 @@
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 @@
}
}
-// 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()