github.com/Mrs4s/MiraiGo@v0.0.0-20240226124653-54bdd873e3fe/utils/tcping_test.go (about) 1 package utils 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 ) 8 9 func TestPing(t *testing.T) { 10 r := RunTCPPingLoop("127.0.0.1:23333", 4) 11 assert.Equal(t, 4, r.PacketsLoss) 12 assert.Equal(t, 4, r.PacketsSent) 13 r = RunTCPPingLoop("114.114.114.114:53", 4) 14 assert.Equal(t, 0, r.PacketsLoss) 15 assert.Equal(t, 4, r.PacketsSent) 16 t.Log(r.AvgTimeMill) 17 }