MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / TestDefaultPolynomial

Function TestDefaultPolynomial

math/pollard_test.go:14–33  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

12)
13
14func TestDefaultPolynomial(t *testing.T) {
15 tests := []struct {
16 name string
17 x *big.Int
18 n *big.Int
19 want *big.Int
20 }{
21 {"Polynomial for n = 1772; x = 535", big.NewInt(535), big.NewInt(1772), big.NewInt(934)},
22 {"Polynomial for n = 666; x = 53135", big.NewInt(53135), big.NewInt(666), big.NewInt(380)},
23 {"Polynomial for n = 666; x = 13", big.NewInt(13), big.NewInt(666), big.NewInt(170)},
24 {"Polynomial for n = 1917; x = 2510", big.NewInt(2510), big.NewInt(1917), big.NewInt(839)},
25 }
26 for _, test := range tests {
27 t.Run(test.name, func(t *testing.T) {
28 if got := DefaultPolynomial(test.n)(test.x); !reflect.DeepEqual(got, test.want) {
29 t.Errorf("DefaultPolynomial() = %v, want %v", got, test.want)
30 }
31 })
32 }
33}
34
35func TestRho(t *testing.T) {
36 tests := []struct {

Callers

nothing calls this directly

Calls 1

DefaultPolynomialFunction · 0.85

Tested by

no test coverage detected