github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/libkb/http_test.go (about) 1 // Copyright 2015 Keybase, Inc. All rights reserved. Use of 2 // this source code is governed by the included BSD license. 3 4 package libkb 5 6 import ( 7 "testing" 8 "testing/quick" 9 ) 10 11 func TestHexEncoding(t *testing.T) { 12 f := func(x uint64) bool { 13 u := UHex{Val: x} 14 s := u.String() 15 for _, c := range s { 16 if c >= '0' && c <= '9' { 17 continue 18 } 19 if c >= 'a' && c <= 'f' { 20 continue 21 } 22 return false 23 } 24 return len(s) == 16 25 } 26 if err := quick.Check(f, nil); err != nil { 27 t.Error(err) 28 } 29 }