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

Function TestPublicAdd

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

Source from the content-addressed store, hash-verified

188}
189
190func TestPublicAdd(test *testing.T) {
191 n := 10
192 t := n/2 + 1
193
194 G := suite.Point().Pick(suite.RandomStream())
195 H := suite.Point().Pick(suite.RandomStream())
196
197 p := NewPriPoly(suite, t, nil, suite.RandomStream())
198 q := NewPriPoly(suite, t, nil, suite.RandomStream())
199
200 P := p.Commit(G)
201 Q := q.Commit(H)
202
203 R, err := P.Add(Q)
204 if err != nil {
205 test.Fatal(err)
206 }
207
208 shares := R.Shares(n)
209 recovered, err := RecoverCommit(suite, shares, t, n)
210 if err != nil {
211 test.Fatal(err)
212 }
213
214 x := P.Commit()
215 y := Q.Commit()
216 z := suite.Point().Add(x, y)
217
218 if !recovered.Equal(z) {
219 test.Fatal("addition of public commitment polynomials failed")
220 }
221}
222
223func TestPublicPolyEqual(test *testing.T) {
224 n := 10

Callers

nothing calls this directly

Calls 11

CommitMethod · 0.95
NewPriPolyFunction · 0.85
RecoverCommitFunction · 0.85
FatalMethod · 0.65
CommitMethod · 0.65
PickMethod · 0.45
PointMethod · 0.45
RandomStreamMethod · 0.45
AddMethod · 0.45
SharesMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected