mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-13 23:16:45 +00:00
* gatio: fix MessageID regression (cherry-pick me) * Update exchanges/gateio/gateio_wrapper_test.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * glorious: AI * Update exchanges/gateio/gateio_wrapper.go Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com> * thrasher: use optimisation in okx as well * okx: Add length check in tests for string -> uuid conversion * thrasher: nits --------- Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Gareth Kirwan <gbjkirwan@gmail.com>
27 lines
683 B
Go
27 lines
683 B
Go
package okx
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/gofrs/uuid"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestMessageID(t *testing.T) {
|
|
t.Parallel()
|
|
id := new(Exchange).MessageID()
|
|
require.Len(t, id, 32, "Must return the correct length of message id")
|
|
u, err := uuid.FromString(id)
|
|
require.NoError(t, err, "MessageID must return a valid UUID")
|
|
require.Equal(t, uuid.V7, u.Version(), "MessageID must return a V7 uuid")
|
|
require.Len(t, u.String(), 36, "UUID v7 string representation must be 36 characters long")
|
|
}
|
|
|
|
// 7696807 153.1 ns/op 48 B/op 2 allocs/op
|
|
func BenchmarkMessageID(b *testing.B) {
|
|
e := new(Exchange)
|
|
for b.Loop() {
|
|
_ = e.MessageID()
|
|
}
|
|
}
|