aboutsummaryrefslogtreecommitdiffstats
path: root/libraries/spongycastle/core/src/test/java/org/spongycastle/pqc/math/ntru/euclid/test/BigIntEuclideanTest.java
blob: 5078090a063482cd6a2944804a135624d196de53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package org.spongycastle.pqc.math.ntru.euclid.test;

import java.math.BigInteger;

import junit.framework.TestCase;
import org.spongycastle.pqc.math.ntru.euclid.BigIntEuclidean;

public class BigIntEuclideanTest
    extends TestCase
{
    public void testCalculate()
    {
        BigIntEuclidean r = BigIntEuclidean.calculate(BigInteger.valueOf(120), BigInteger.valueOf(23));
        assertEquals(BigInteger.valueOf(-9), r.x);
        assertEquals(BigInteger.valueOf(47), r.y);
        assertEquals(BigInteger.valueOf(1), r.gcd);

        r = BigIntEuclidean.calculate(BigInteger.valueOf(126), BigInteger.valueOf(231));
        assertEquals(BigInteger.valueOf(2), r.x);
        assertEquals(BigInteger.valueOf(-1), r.y);
        assertEquals(BigInteger.valueOf(21), r.gcd);
    }
}