Files
mautrix-telegram/pkg/gotd/crypto/session_id_test.go
T
2025-06-27 20:03:37 -07:00

26 lines
447 B
Go

package crypto
import (
"crypto/rand"
mathrand "math/rand"
"testing"
)
func TestNewSessionID(t *testing.T) {
t.Run("Crypto", func(t *testing.T) {
if _, err := NewSessionID(rand.Reader); err != nil {
t.Fatal(err)
}
})
t.Run("Math", func(t *testing.T) {
rnd := mathrand.New(mathrand.NewSource(239))
n, err := NewSessionID(rnd)
if err != nil {
t.Fatal(err)
}
if n != 2092333242585417206 {
t.Fatal("mismatch")
}
})
}