@Test
  public void testBasicSum() {
    for (int i = 0; i < NUM_BASIC_TESTS; i++) {
      BigInteger expectedResult = x[i].add(y[i]).mod(P);
      byte[] xBytes = toLittleEndian(x[i]);
      byte[] yBytes = toLittleEndian(y[i]);
      long[] output = new long[LIMB_CNT * 2 + 1];
      Field25519.sum(output, Field25519.expand(xBytes), Field25519.expand(yBytes));
      Field25519.reduceCoefficients(output);
      BigInteger result = new BigInteger(reverse(Field25519.contract(output)));
      assertEquals("Sum x[i] + y[i]: " + x[i] + "+" + y[i], expectedResult, result);
    }
  }
The idea of basic tests is simple. We generate random numbers, make computations with
Field25519 and compare the results with Java BigInteger.
java_src/src/test/java/com/google/crypto/tink/internal/Field25519Test.java