1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 11:07:40 +08:00
MiraiGo/utils/tcping_test.go
2022-05-10 19:28:39 +08:00

18 lines
359 B
Go

package utils
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestPing(t *testing.T) {
r := RunTCPPingLoop("127.0.0.1:23333", 4)
assert.Equal(t, 4, r.PacketsLoss)
assert.Equal(t, 4, r.PacketsSent)
r = RunTCPPingLoop("114.114.114.114:53", 4)
assert.Equal(t, 0, r.PacketsLoss)
assert.Equal(t, 4, r.PacketsSent)
t.Log(r.AvgTimeMill)
}