siprng_test.go 483 B

1234567891011121314151617181920212223
  1. // Copyright 2014 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package captcha
  5. import "testing"
  6. func TestSiphash(t *testing.T) {
  7. good := uint64(0xe849e8bb6ffe2567)
  8. cur := siphash(0, 0, 0)
  9. if cur != good {
  10. t.Fatalf("siphash: expected %x, got %x", good, cur)
  11. }
  12. }
  13. func BenchmarkSiprng(b *testing.B) {
  14. b.SetBytes(8)
  15. p := &siprng{}
  16. for i := 0; i < b.N; i++ {
  17. p.Uint64()
  18. }
  19. }