byte_base10_test.go 437 B

12345678910111213141516171819202122232425
  1. package protocol
  2. import (
  3. "testing"
  4. )
  5. var result uint64
  6. func BenchmarkByteToBase10Valid(b *testing.B) {
  7. bt := []byte{'3', '1', '4', '1', '5', '9', '2', '5'}
  8. var n uint64
  9. for i := 0; i < b.N; i++ {
  10. n, _ = ByteToBase10(bt)
  11. }
  12. result = n
  13. }
  14. func BenchmarkByteToBase10Invalid(b *testing.B) {
  15. bt := []byte{'?', '1', '4', '1', '5', '9', '2', '5'}
  16. var n uint64
  17. for i := 0; i < b.N; i++ {
  18. n, _ = ByteToBase10(bt)
  19. }
  20. result = n
  21. }