static KotterAlgorithmBasedBuilderTests() { var gf5 = new PrimeOrderField(5); var gf8 = new PrimePowerOrderField(8, new Polynomial(new PrimeOrderField(2), 1, 1, 0, 1)); var gf27 = new PrimePowerOrderField(27, new Polynomial(new PrimeOrderField(3), 2, 2, 0, 1)); var degreeWeight = new Tuple <int, int>(1, 2); SuccessConstructionTestsData = new TheoryData <InterpolationPolynomialBuilderTestCase> { new InterpolationPolynomialBuilderTestCase { DegreeWeight = degreeWeight, MaxWeightedDegree = 3, Roots = new[] { Tuple.Create(gf5.One(), gf5.CreateElement(3)), Tuple.Create(gf5.CreateElement(2), gf5.CreateElement(4)) } }, new InterpolationPolynomialBuilderTestCase { DegreeWeight = degreeWeight, MaxWeightedDegree = 3, Roots = new[] { Tuple.Create(gf8.CreateElement(3), gf8.CreateElement(7)), Tuple.Create(gf8.CreateElement(5), gf8.CreateElement(4)) } }, new InterpolationPolynomialBuilderTestCase { DegreeWeight = degreeWeight, MaxWeightedDegree = 3, Roots = new[] { Tuple.Create(gf27.CreateElement(15), gf27.CreateElement(26)), Tuple.Create(gf27.CreateElement(10), gf27.CreateElement(9)) } } }; FailConstructionTestsData = new TheoryData <InterpolationPolynomialBuilderTestCase> { new InterpolationPolynomialBuilderTestCase { DegreeWeight = degreeWeight, MaxWeightedDegree = 2, Roots = new[] { Tuple.Create(gf27.One(), gf27.CreateElement(16)), Tuple.Create(gf27.CreateElement(13), gf27.CreateElement(26)), Tuple.Create(gf27.CreateElement(10), gf27.CreateElement(15)), Tuple.Create(gf27.CreateElement(8), gf27.CreateElement(5)) } } }; }
static PascalsTriangleBasedCalculatorTests() { Gf27 = new PrimePowerOrderField(27, new Polynomial(new PrimeOrderField(3), 2, 2, 0, 1)); CalculatorTestsData = new TheoryData <CombinationsCountCalculatorTestCase> { new CombinationsCountCalculatorTestCase { Field = Gf27, N = 6, K = 3, Expected = Gf27.CreateElement(2) }, new CombinationsCountCalculatorTestCase { Field = Gf27, N = 4, K = 2, Expected = Gf27.Zero() }, new CombinationsCountCalculatorTestCase { Field = Gf27, N = 52, K = 5, Expected = Gf27.Zero() }, new CombinationsCountCalculatorTestCase { Field = Gf27, N = 52, K = 5, Expected = Gf27.Zero() }, new CombinationsCountCalculatorTestCase { Field = Gf27, N = 13, K = 3, Expected = Gf27.One() }, new CombinationsCountCalculatorTestCase { Field = Gf27, N = 13, K = 10, Expected = Gf27.One() }, new CombinationsCountCalculatorTestCase { Field = Gf27, N = 4, K = 3, Expected = Gf27.One() } }; }