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

Function TestPriPolyMul

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

Source from the content-addressed store, hash-verified

246}
247
248func TestPriPolyMul(test *testing.T) {
249 n := 10
250 t := n/2 + 1
251 a := NewPriPoly(suite, t, nil, suite.RandomStream())
252 b := NewPriPoly(suite, t, nil, suite.RandomStream())
253
254 c := a.Mul(b)
255 assert.Equal(test, len(a.coeffs)+len(b.coeffs)-1, len(c.coeffs))
256 nul := suite.Scalar().Zero()
257 for _, coeff := range c.coeffs {
258 assert.NotEqual(test, nul.String(), coeff.String())
259 }
260
261 a0 := a.coeffs[0]
262 b0 := b.coeffs[0]
263 mul := suite.Scalar().Mul(b0, a0)
264 c0 := c.coeffs[0]
265 assert.Equal(test, c0.String(), mul.String())
266
267 at := a.coeffs[len(a.coeffs)-1]
268 bt := b.coeffs[len(b.coeffs)-1]
269 mul = suite.Scalar().Mul(at, bt)
270 ct := c.coeffs[len(c.coeffs)-1]
271 assert.Equal(test, ct.String(), mul.String())
272}
273
274func TestRecoverPriPoly(test *testing.T) {
275 n := 10

Callers

nothing calls this directly

Calls 7

MulMethod · 0.95
NewPriPolyFunction · 0.85
RandomStreamMethod · 0.45
EqualMethod · 0.45
ZeroMethod · 0.45
ScalarMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected