MCPcopy
hub / github.com/rs/xid / TestPadding

Function TestPadding

id_test.go:66–81  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

64}
65
66func TestPadding(t *testing.T) {
67 for i := 0; i < 100000; i++ {
68 wantBytes := make([]byte, 20)
69 wantBytes[19] = encoding[0] // 0
70 copy(wantBytes[0:13], []byte("c6e52g2mrqcjl")[:]) // c6e52g2mrqcjl44hf170
71 for j := 0; j < 6; j++ {
72 wantBytes[13+j] = encoding[rand.Intn(32)]
73 }
74 want := string(wantBytes)
75 id, _ := FromString(want)
76 got := id.String()
77 if got != want {
78 t.Errorf("String() = %v, want %v %v", got, want, wantBytes)
79 }
80 }
81}
82
83func TestNew(t *testing.T) {
84 // Generate 10 ids

Callers

nothing calls this directly

Calls 2

FromStringFunction · 0.85
StringMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…