MCPcopy Create free account
hub / github.com/DOSNetwork/core / TestPrivateAdd

Function TestPrivateAdd

share/poly_test.go:169–188  ·  view source on GitHub ↗
(test *testing.T)

Source from the content-addressed store, hash-verified

167}
168
169func TestPrivateAdd(test *testing.T) {
170 n := 10
171 t := n/2 + 1
172
173 p := NewPriPoly(suite, t, nil, suite.RandomStream())
174 q := NewPriPoly(suite, t, nil, suite.RandomStream())
175
176 r, err := p.Add(q)
177 if err != nil {
178 test.Fatal(err)
179 }
180
181 ps := p.Secret()
182 qs := q.Secret()
183 rs := suite.Scalar().Add(ps, qs)
184
185 if !rs.Equal(r.Secret()) {
186 test.Fatal("addition of secret sharing polynomials failed")
187 }
188}
189
190func TestPublicAdd(test *testing.T) {
191 n := 10

Callers

nothing calls this directly

Calls 7

AddMethod · 0.95
SecretMethod · 0.95
NewPriPolyFunction · 0.85
FatalMethod · 0.65
RandomStreamMethod · 0.45
ScalarMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected