1 // Copyright (C) The Lightning Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
13 type pvalueSuite struct{}
15 var _ = check.Suite(&pvalueSuite{})
17 func (s *pvalueSuite) TestPvalue(c *check.C) {
20 for i := 0; i < 25; i++ {
24 for i := 25; i < 31; i++ {
27 for i := 31; i < 40; i++ {
30 c.Check(fmt.Sprintf("%.8f", pvalue(a, b)), check.Equals, "0.04147853")
34 for i := 0; i < 25; i++ {
38 c.Check(fmt.Sprintf("%.9f", pvalue(a, b)), check.Equals, "0.000000072")
42 c.Check(fmt.Sprintf("%.9f", pvalue(a, b)), check.Equals, "0.000000573")
44 a = []bool{true, true, true, false, true, false, false, false}
45 b = []bool{true, true, true, true, false, false, false, false}
46 c.Check(fmt.Sprintf("%.8f", pvalue(a, b)), check.Equals, "0.31731051")
50 c.Check(fmt.Sprintf("%.8f", pvalue(a, b)), check.Equals, "0.31731051")
52 for _, sz := range []int{128, 1024, 4096, 16384} {
56 c.Check(fmt.Sprintf("%.8f", pvalue(a, b)), check.Equals, "1.00000000")
57 for i := 0; i < len(a)/23; i++ {
60 for i := 0; i < len(a)/2; i++ {
63 c.Logf("pvalue(a,b) == %e", pvalue(a, b))
64 c.Logf("pvalue(b,a) == %e", pvalue(b, a))
65 c.Check(pvalue(a, b), check.Not(check.Equals), float64(0))
66 c.Check(pvalue(b, a), check.Not(check.Equals), float64(0))