-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathpoker_test.go
38 lines (33 loc) · 1.27 KB
/
poker_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
package randomness
import (
"fmt"
"testing"
)
func TestPokerTestSample(t *testing.T) {
p, q := PokerProto(sampleTestBits128, 4)
fmt.Printf("n: %v, P-value: %f, Q-value: %f\n", len(sampleTestBits128), p, q)
if fmt.Sprintf("%.6f", p) != "0.213734" || fmt.Sprintf("%.6f", q) != "0.213734" {
t.FailNow()
}
}
func TestPokerTestM8Sample(t *testing.T) {
p, q := PokerProto(sampleTestBits128, 8)
fmt.Printf("n: %v, P-value: %f, Q-value: %f\n", len(sampleTestBits128), p, q)
if fmt.Sprintf("%.6f", p) != "0.221829" || fmt.Sprintf("%.6f", q) != "0.221829" {
t.FailNow()
}
}
func TestPokerTestByteSample(t *testing.T) {
p, q := PokerTestBytes([]byte{0xcc, 0x15, 0x6c, 0x4c, 0xe0, 0x02, 0x4d, 0x51, 0x13, 0xd6, 0x80, 0xd7, 0xcc, 0xe6, 0xd8, 0xb2}, 4)
fmt.Printf("n: %v, P-value: %f, Q-value: %f\n", len(sampleTestBits128), p, q)
if fmt.Sprintf("%.6f", p) != "0.213734" || fmt.Sprintf("%.6f", q) != "0.213734" {
t.FailNow()
}
}
func TestPokerTestByteM8Sample(t *testing.T) {
p, q := PokerTestBytes([]byte{0xcc, 0x15, 0x6c, 0x4c, 0xe0, 0x02, 0x4d, 0x51, 0x13, 0xd6, 0x80, 0xd7, 0xcc, 0xe6, 0xd8, 0xb2}, 8)
fmt.Printf("n: %v, P-value: %f, Q-value: %f\n", len(sampleTestBits128), p, q)
if fmt.Sprintf("%.6f", p) != "0.221829" || fmt.Sprintf("%.6f", q) != "0.221829" {
t.FailNow()
}
}