aboutsummaryrefslogtreecommitdiffstats
path: root/libraries/spongycastle/core/src/test/java/org/spongycastle/pqc/math/ntru/polynomial/test/BigIntPolynomialTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/spongycastle/core/src/test/java/org/spongycastle/pqc/math/ntru/polynomial/test/BigIntPolynomialTest.java')
-rw-r--r--libraries/spongycastle/core/src/test/java/org/spongycastle/pqc/math/ntru/polynomial/test/BigIntPolynomialTest.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/libraries/spongycastle/core/src/test/java/org/spongycastle/pqc/math/ntru/polynomial/test/BigIntPolynomialTest.java b/libraries/spongycastle/core/src/test/java/org/spongycastle/pqc/math/ntru/polynomial/test/BigIntPolynomialTest.java
new file mode 100644
index 000000000..334ece968
--- /dev/null
+++ b/libraries/spongycastle/core/src/test/java/org/spongycastle/pqc/math/ntru/polynomial/test/BigIntPolynomialTest.java
@@ -0,0 +1,26 @@
+package org.spongycastle.pqc.math.ntru.polynomial.test;
+
+import java.math.BigInteger;
+
+import junit.framework.TestCase;
+import org.spongycastle.pqc.math.ntru.polynomial.BigIntPolynomial;
+import org.spongycastle.pqc.math.ntru.polynomial.IntegerPolynomial;
+
+public class BigIntPolynomialTest
+ extends TestCase
+{
+ public void testMult()
+ {
+ BigIntPolynomial a = new BigIntPolynomial(new IntegerPolynomial(new int[]{4, -1, 9, 2, 1, -5, 12, -7, 0, -9, 5}));
+ BigIntPolynomial b = new BigIntPolynomial(new IntegerPolynomial(new int[]{-6, 0, 0, 13, 3, -2, -4, 10, 11, 2, -1}));
+ BigIntPolynomial c = a.mult(b);
+ BigInteger[] expectedCoeffs = new BigIntPolynomial(new IntegerPolynomial(new int[]{2, -189, 77, 124, -29, 0, -75, 124, -49, 267, 34})).getCoeffs();
+ BigInteger[] cCoeffs = c.getCoeffs();
+
+ assertEquals(expectedCoeffs.length, cCoeffs.length);
+ for (int i = 0; i != cCoeffs.length; i++)
+ {
+ assertEquals(expectedCoeffs[i], cCoeffs[i]);
+ }
+ }
+} \ No newline at end of file