CoordinateEd25519 extends Coordinate { @Override public Coordinate negate() { return new CoordinateEd25519(value.negate()).mod(); } CoordinateEd25519(BigInteger integer); @Override final Coordinate add(Coordinate val); @Override final Coordinate divide(Coordinate val); @Override final Coordinate multiply(Coordinate val); @Override final Coordinate subtract(Coordinate val); @Override final Coordinate mod(); @Override final Coordinate inverse(); @Override Coordinate powerMod(BigInteger exponent); @Override Coordinate negate(); @Override EncodedCoordinate encode(); static final CoordinateEd25519 ONE; }
@Test public void success_Negate_1() { Coordinate coordinate1 = new CoordinateEd25519(new BigInteger("15112221349535400772501151409588531511454012693041857206046113283949847762202")); Coordinate coordinate2 = new CoordinateEd25519(new BigInteger("46316835694926478169428394003475163141307993866256225615783033603165251855960")); Coordinate coordinate3 = new CoordinateEd25519(new BigInteger("29526982755515629833010601177215416502583846089738343830061683922017848058174")); Coordinate coordinate4 = new CoordinateEd25519(new BigInteger("38867791596533294917564303539771571723867178851912571219685671691706937241210")); Coordinate negated1 = coordinate1.negate(); Coordinate negated2 = coordinate2.negate(); Coordinate negated3 = coordinate3.negate(); Coordinate negated4 = coordinate4.negate(); assertThat(negated1.getInteger(), is(new BigInteger("42783823269122696939284341094755422415180979639778424813682678720006717057747"))); assertThat(negated2.getInteger(), is(new BigInteger("11579208923731619542357098500868790785326998466564056403945758400791312963989"))); assertThat(negated3.getInteger(), is(new BigInteger("28369061863142467878774891327128537424051146243081938189667108081938716761775"))); assertThat(negated4.getInteger(), is(new BigInteger("19028253022124802794221188964572382202767813480907710800043120312249627578739"))); }