Пример #1
0
        public void CmpTest()
        {
            const int length = 4;
            Random    random = new Random(1234);

            for (int i = 0; i <= 2500; i++)
            {
                UInt32[] mantissa1 = UIntUtil.Random(random, length, random.Next(length * UIntUtil.UInt32Bits + 1));
                UInt32[] mantissa2 = UIntUtil.Random(random, length, random.Next(length * UIntUtil.UInt32Bits + 1));

                BigUInt <Pow2.N4> n1 = new BigUInt <Pow2.N4>(mantissa1, enable_clone: false);
                BigUInt <Pow2.N4> n2 = random.Next(8) < 7 ? new BigUInt <Pow2.N4>(mantissa2, enable_clone: false) : n1.Copy();
                BigInteger        bi1 = n1, bi2 = n2;

                Console.WriteLine(n1);
                Console.WriteLine(n2);

                Assert.AreEqual(n1.Equals(n2), bi1.Equals(bi2));
                Assert.AreEqual(n1 == n2, bi1 == bi2);
                Assert.AreEqual(n1 != n2, bi1 != bi2);
                Assert.AreEqual(n1 < n2, bi1 < bi2);
                Assert.AreEqual(n1 > n2, bi1 > bi2);
                Assert.AreEqual(n1 <= n2, bi1 <= bi2);
                Assert.AreEqual(n1 >= n2, bi1 >= bi2);

                Console.Write("\n");
            }
        }