public void testSubAnd() { IntegerPolynomial i1 = new IntegerPolynomial(new int[] { 1368, 2047, 672, 871, 1662, 1352, 1099, 1608 }); IntegerPolynomial i2 = new IntegerPolynomial(new int[] { 1729, 1924, 806, 179, 1530, 1381, 1695, 60 }); LongPolynomial2 a = new LongPolynomial2(i1); LongPolynomial2 b = new LongPolynomial2(i2); a.SubAnd(b, 2047); i1.Sub(i2); i1.ModPositive(2048); Assert.True(a.ToIntegerPolynomial().coeffs.SequenceEqual(i1.coeffs)); }
private void SubAndTest() { IntegerPolynomial i1 = new IntegerPolynomial(new int[] { 1368, 2047, 672, 871, 1662, 1352, 1099, 1608 }); IntegerPolynomial i2 = new IntegerPolynomial(new int[] { 1729, 1924, 806, 179, 1530, 1381, 1695, 60 }); LongPolynomial2 a = new LongPolynomial2(i1); LongPolynomial2 b = new LongPolynomial2(i2); a.SubAnd(b, 2047); i1.Subtract(i2); i1.ModPositive(2048); if (!Compare.AreEqual(a.ToIntegerPolynomial().Coeffs, i1.Coeffs)) { throw new Exception("LongPolynomial2 SubAnd test failed!"); } }