-
Notifications
You must be signed in to change notification settings - Fork 0
/
crdnm_amd64_test.go
103 lines (90 loc) · 1.95 KB
/
crdnm_amd64_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// Copyrigth 2022 - mailto:seantolstoyevski@protonmail.com
//
// The source codes of this project are licensed under the MIT license.
//
// It is provided without any warranty.
//go:build !noasm || !appengine
// +build !noasm !appengine
package crndm
import (
"testing"
)
// func TestRdseedAsuint16(t *testing.T) {
// const rangeMax = 65100
// var v uint16
// for i := 1000; i < rangeMax; i++ {
// v = uint16(i)
// if !RdseedAsUint16(&v) {
// t.Fatalf("RdseedAsuint16 error: %d", i)
// }
// }
// }
// func TestRdseedAsUint32(t *testing.T) {
// const rangeMax = 4000000
// var v uint32
// for i := rangeMax - 1000; i < rangeMax; i++ {
// v = uint32(i)
// if !RdseedAsUint32(&v) {
// t.Fatalf("RdseedAsuint32 error: %d", i)
// }
// }
// }
// func TestRdseedAsuint64(t *testing.T) {
// const rangeMax = 30303030303
// var v uint64
// for i := rangeMax - 1000; i < rangeMax; i++ {
// v = uint64(i)
// if !RdseedAsUint64(&v) {
// t.Fatalf("RdseedAsuint64 error: %d", i)
// }
// }
// }
// func TestRdseedAsUint64_2(t *testing.T) {
// t.Log("working...")
// v := uint64(94821932)
// if !RdseedAsUint64(&v) {
// t.Fatal("TestRdseedAsuint64_2")
// }
// }
func TestCrmdnAsUint64(t *testing.T) {
for i := 0; i < 150; i++ {
if CrmdnAsUint64() == 0 {
t.Fatal("CrmdnAsUint64 returns zero")
}
}
}
func BenchmarkCrmdnAsUint64(b *testing.B) {
var v uint64
for i := 0; i < b.N; i++ {
v = CrmdnAsUint64()
}
_ = v
}
func TestCrmdnAsUint32(t *testing.T) {
for i := 0; i < 150; i++ {
if CrmdnAsUint32() == 0 {
t.Fatal("CrmdnAsUint32 returns zero")
}
}
}
func BenchmarkCrmdnAsUint32(b *testing.B) {
var v uint32
for i := 0; i < b.N; i++ {
v = CrmdnAsUint32()
}
_ = v
}
func TestCrmdnAsUint16(t *testing.T) {
for i := 0; i < 150; i++ {
if CrmdnAsUint16() == 0 {
t.Fatal("CrmdnAsUint16 returns zero")
}
}
}
func BenchmarkCrmdnAsUint16(b *testing.B) {
var v uint16
for i := 0; i < b.N; i++ {
v = CrmdnAsUint16()
}
_ = v
}