Пример #1
0
        public void TestCompareTo()
        {
            ECFieldElement X1 = new ECFieldElement(new BigInteger(100), ECCurve.Secp256k1);
            ECFieldElement X2 = new ECFieldElement(new BigInteger(200), ECCurve.Secp256k1);
            ECFieldElement X3 = new ECFieldElement(new BigInteger(100), ECCurve.Secp256r1);

            X1.CompareTo(X2).Should().Be(-1);
            Action action = () => X1.CompareTo(X3);

            action.Should().Throw <InvalidOperationException>();
        }
Пример #2
0
        public int CompareTo(ECPoint other)
        {
            if (ReferenceEquals(this, other))
            {
                return(0);
            }
            int result = X.CompareTo(other.X);

            if (result != 0)
            {
                return(result);
            }
            return(Y.CompareTo(other.Y));
        }