Exemple #1
0
func testRandString(tt testing2.TB, f func(int) (string, error), charset string) {
	s, e := f(32)
	tt.
		Eq(e, nil).
		Eq(32, len(s)).
		True(strings2.IsAllCharsIn(s, charset))
}
Exemple #2
0
func testRandBytes(tt testing2.TB, f func(int) ([]byte, error), charset string) {
	s, e := f(32)
	tt.
		Eq(e, nil).
		Eq(32, len(s)).
		True(strings2.IsAllCharsIn(unsafe2.String(s), charset))
}
Exemple #3
0
func (c Chars) Validate(s string) error {
	if !strings2.IsAllCharsIn(s, c.Chars) {
		return c.Err
	}

	return nil
}