Exemplo n.º 1
0
 public void TestCompareTo()
 {
     Assert.IsTrue(MyInt64_3.CompareTo(MyInt64_2) > 0);
     Assert.IsTrue(MyInt64_2.CompareTo(MyInt64_2) == 0);
     Assert.IsTrue(MyInt64_1.CompareTo((object)(Int64)(-42)) == 0);
     Assert.IsTrue(MyInt64_2.CompareTo(MyInt64_3) < 0);
     try {
         MyInt64_2.CompareTo((object)(Int16)100);
         Assert.Fail("Should raise a System.ArgumentException");
     }
     catch (Exception e) {
         Assert.IsTrue(typeof(ArgumentException) == e.GetType());
     }
 }
        static public int MyCustomSort(Transform a, Transform b)
        {
            Int64 c1 = Convert.ToInt64(a.name);
            Int64 c2 = Convert.ToInt64(b.name);

            return(c2.CompareTo(c1));
        }
Exemplo n.º 3
0
        public Int32 CompareTo(CoordinatePair other)
        {
            Int64 product      = (Int64)X * Y;
            Int64 otherProduct = (Int64)other.X * other.Y;

            return(product.CompareTo(otherProduct));
        }
Exemplo n.º 4
0
 public int CompareTo(object obj)
 {
     if (obj is DiscreteTime)
     {
         return(m_DiscreteTime.CompareTo(((DiscreteTime)obj).m_DiscreteTime));
     }
     return(1);
 }
Exemplo n.º 5
0
 public override int CompareTo(VHDLScalarValue obj)
 {
     if (obj is VHDLIntegerValue)
     {
         VHDLIntegerValue els = obj as VHDLIntegerValue;
         return(mValue.CompareTo(els.mValue));
     }
     throw new ArgumentException("Could not cast {0} to VHDLIntegerValue", obj.GetType().Name);
 }
Exemplo n.º 6
0
        /// <summary>
        /// Compares this instance to a specified <see cref="SecsInt64"/> object and returns an integer that indicates their relationship to one another.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <returns></returns>
        public int CompareTo(SecsInt64 value)
        {
            if (value == null)
            {
                return(1);
            }

            return(_value.CompareTo(value._value));
        }
Exemplo n.º 7
0
 public int CompareTo(object obj)
 {
     if (obj is FileGap)
     {
         FileGap temp = (FileGap)obj;
         return(m_start.CompareTo(temp.m_start));
     }
     throw new ArgumentException("object is not a FileGap");
 }
Exemplo n.º 8
0
 public override int CompareTo(VHDLScalarValue obj)
 {
     if (obj is VHDLPhysicalValue <T> )
     {
         VHDLPhysicalValue <T> els = obj as VHDLPhysicalValue <T>;
         return(mValue.CompareTo(els.mValue));
     }
     throw new ArgumentException(string.Format("Could not cast {0} to VHDLPhysicalValue<{1}>", obj.GetType().Name, GetType().Name));
 }
Exemplo n.º 9
0
        public int CompareTo(IndexEntryV1 other)
        {
            var keyCmp = Key.CompareTo(other.Key);

            if (keyCmp != 0)
            {
                return(keyCmp);
            }
            return(Position.CompareTo(other.Position));
        }
Exemplo n.º 10
0
        Int32 CompareTo(Int64 a, Int64 b, Int64 c, Int64 d)
        {
            Int32 cmpVal = a.CompareTo(c);

            if (cmpVal != 0)
            {
                return(cmpVal);
            }
            return(b.CompareTo(d));
        }
Exemplo n.º 11
0
        public Int32 CompareTo(Money other)
        {
            checkCurrencies(other);

            var unitCompare = _units.CompareTo(other._units);

            return(unitCompare == 0
                ? _decimalFraction.CompareTo(other._decimalFraction)
                : unitCompare);
        }
Exemplo n.º 12
0
 /// <summary>
 /// Compares one SmartInt64 to another.
 /// </summary>
 /// <remarks>
 /// This method works the same as the <see cref="int.CompareTo"/> method
 /// on the Int inttype, with the exception that it
 /// understands the concept of empty int values.
 /// </remarks>
 /// <param name="value">The int to which we are being compared.</param>
 /// <returns>A value indicating if the comparison int is less than, equal to or greater than this int.</returns>
 public int CompareTo(SmartInt64 value)
 {
     if (this.IsEmpty && value.IsEmpty)
     {
         return(0);
     }
     else
     {
         return(_int.CompareTo(value.Int));
     }
 }
        public int Compare(Item x, Item y)
        {
            if (x.GetType() == typeof(Folder) || y.GetType() == typeof(Folder))
            {
                return(0);
            }

            Int64 temp1 = Int64.Parse(x.StrSize);
            Int64 temp2 = Int64.Parse(y.StrSize);

            return(temp2.CompareTo(temp1));
        }
Exemplo n.º 14
0
 public static int CompareTo([JsFakeThis] Int64 _this, object other)
 {
     if (other == null)
     {
         return(1);
     }
     if (!(other is Int64))
     {
         throw new ArgumentException();
     }
     return(_this.CompareTo((Int64)other));
 }
Exemplo n.º 15
0
        private void MethodTests()
        {
            featureTest.FailureMessage = "\tFailed Int64 Method Test";
            featureTest.Send("Int64 Method Test");
            Int64  value1 = 1;
            Int64  value2 = 2;
            Int64  value3 = 3;
            Object obj1   = value1;
            Object obj2   = value2;
            Object obj3   = value3;

            featureTest.AssertTrue(value2.CompareTo(value1) > 0);
            featureTest.AssertTrue(value2.CompareTo(value3) < 0);
            featureTest.AssertTrue(value2.CompareTo(value2) == 0);

            featureTest.AssertTrue(value2.CompareTo(obj1) > 0);
            featureTest.AssertTrue(value2.CompareTo(obj3) < 0);
            featureTest.AssertTrue(value2.CompareTo(obj2) == 0);

            featureTest.AssertTrue(!value2.Equals(value1));
            featureTest.AssertTrue(!value2.Equals(value3));
            featureTest.AssertTrue(value2.Equals(value2));

            featureTest.AssertTrue(!value2.Equals(obj1));
            featureTest.AssertTrue(!value2.Equals(obj3));
            featureTest.AssertTrue(value2.Equals(obj2));
            featureTest.AssertTrue(Int64.Parse("33") == 33);
            String str = 35.ToString();

            featureTest.AssertTrue(str == "35");
            Int64 parsed;

            featureTest.AssertTrue(Int64.TryParse(str, out parsed));
            featureTest.AssertTrue(parsed == 35);
        }
Exemplo n.º 16
0
    public static void TestCompareTo()
    {
        Int64 i = 234;

        Assert.Equal(0, i.CompareTo((Int64)234));

        Assert.True(i.CompareTo(Int64.MinValue) > 0);
        Assert.True(i.CompareTo((Int64)0) > 0);
        Assert.True(i.CompareTo((Int64)(-123)) > 0);
        Assert.True(i.CompareTo((Int64)123) > 0);
        Assert.True(i.CompareTo((Int64)456) < 0);
        Assert.True(i.CompareTo(Int64.MaxValue) < 0);
    }
Exemplo n.º 17
0
        public int CompareTo(IndexEntry other)
        {
            var keyCmp = Stream.CompareTo(other.Stream);

            if (keyCmp == 0)
            {
                keyCmp = Version.CompareTo(other.Version);
                if (keyCmp != 0)
                {
                    return(keyCmp);
                }
            }
            if (keyCmp != 0)
            {
                return(keyCmp);
            }
            return(Position.CompareTo(other.Position));
        }
Exemplo n.º 18
0
        public override int CompareValueTo(int recordNo, object value)
        {
            System.Diagnostics.Debug.Assert(0 <= recordNo, "Invalid record");
            System.Diagnostics.Debug.Assert(null != value, "null value");

            if (NullValue == value)
            {
                return(HasValue(recordNo) ? 1 : 0);
            }

            Int64 valueNo1 = values[recordNo];

            if ((defaultValue == valueNo1) && !HasValue(recordNo))
            {
                return(-1);
            }
            return(valueNo1.CompareTo((Int64)value));
            //return(valueNo1 < valueNo2 ? -1 : (valueNo1 > valueNo2 ? 1 : 0)); // similar to Int64.CompareTo(Int64)
        }
Exemplo n.º 19
0
    private static int SortFun(Int64 numa, Int64 numb, Int64 exclude)
    {
        int result;

        if (numa == exclude || numb == exclude)
        {
            if (numa == numb)
            {
                result = 0;
            }
            else
            {
                if (numa == exclude)
                {
                    result = 1;
                }
                else
                {
                    result = -1;
                }
            }
        }
        else
        {
            if (numa == numb)
            {
                result = 0;
            }
            else
            {
                if (numa.CompareTo(numb) > 0)
                {
                    result = -1;
                }
                else
                {
                    result = 1;
                }
            }
        }
        return(result);
    }
Exemplo n.º 20
0
            /// <summary>
            ///   Compares this value to another.</summary>
            /// <param name="value">
            ///   Other value.</param>
            /// <returns>
            ///   -1 if this value is less, 0 if equal, 1 if greater</returns>
            public int CompareTo(LanguageIDTextKey value)
            {
                var result = _languageID.CompareTo(value._languageID);

                return((result == 0) ? _textKey.CompareTo(value._textKey) : result);
            }
Exemplo n.º 21
0
 /// <summary>
 ///     A T extension method that check if the value is between inclusively the minValue and maxValue.
 /// </summary>
 /// <param name="this">The @this to act on.</param>
 /// <param name="minValue">The minimum value.</param>
 /// <param name="maxValue">The maximum value.</param>
 /// <returns>true if the value is between inclusively the minValue and maxValue, otherwise false.</returns>
 /// ###
 /// <typeparam name="T">Generic type parameter.</typeparam>
 public static bool InRange(this Int64 @this, Int64 minValue, Int64 maxValue)
 {
     return(@this.CompareTo(minValue) >= 0 && @this.CompareTo(maxValue) <= 0);
 }
Exemplo n.º 22
0
        /// <summary>
        /// Compares two postcodes (universally) and determines which is greater.
        /// </summary>
        /// <param name="APostcodeA"></param>
        /// <param name="APostcodeB"></param>
        /// <returns>-1 if APostcodeB is greater, 0 if equal, 1 if APostcodeA is greater</returns>
        private static int ComparePostcodes(string APostcodeA, string APostcodeB)
        {
            int ReturnValue = 0;

            //
            // if postcode only contains numbers
            //

            int PostcodeLettersA = Regex.Matches(APostcodeA, @"[a-zA-Z]").Count;
            int PostcodeLettersB = Regex.Matches(APostcodeB, @"[a-zA-Z]").Count;

            if ((PostcodeLettersA == 0) && (PostcodeLettersB == 0))
            {
                Int64 PostcodeNumberA = Convert.ToInt64(APostcodeA.Replace(" ", "").Replace("-", ""));
                Int64 PostcodeNumberB = Convert.ToInt64(APostcodeB.Replace(" ", "").Replace("-", ""));

                return(PostcodeNumberA.CompareTo(PostcodeNumberB));
            }

            //
            // if postcode contains letters as well
            //

            // if postcode contains a space or a hyphen then use recursion to compare both halves
            int SpaceIndexA  = APostcodeA.IndexOf(' ');
            int SpaceIndexB  = APostcodeB.IndexOf(' ');
            int HyphenIndexA = APostcodeA.IndexOf('-');
            int HyphenIndexB = APostcodeB.IndexOf('-');

            if ((SpaceIndexA != -1) || (SpaceIndexB != -1))
            {
                if (SpaceIndexA == -1)
                {
                    SpaceIndexA = APostcodeA.Length;
                }

                if (SpaceIndexB == -1)
                {
                    SpaceIndexB = APostcodeB.Length;
                }

                int CompareSubstring = ComparePostcodes(APostcodeA.Substring(0, SpaceIndexA), APostcodeB.Substring(0, SpaceIndexB));

                if (CompareSubstring == 0)
                {
                    if (SpaceIndexA + 1 >= APostcodeA.Length)
                    {
                        return(-1);
                    }
                    else if (SpaceIndexB + 1 >= APostcodeB.Length)
                    {
                        return(1);
                    }

                    return(ComparePostcodes(APostcodeA.Substring(SpaceIndexA + 1), APostcodeB.Substring(SpaceIndexB + 1)));
                }
                else
                {
                    return(CompareSubstring);
                }
            }

            if ((HyphenIndexA != -1) || (HyphenIndexB != -1))
            {
                if (HyphenIndexA == -1)
                {
                    HyphenIndexA = APostcodeA.Length;
                }

                if (HyphenIndexB == -1)
                {
                    HyphenIndexB = APostcodeB.Length;
                }

                int CompareSubstring = ComparePostcodes(APostcodeA.Substring(0, HyphenIndexA), APostcodeB.Substring(0, HyphenIndexB));

                if (CompareSubstring == 0)
                {
                    if (HyphenIndexA + 1 >= APostcodeA.Length)
                    {
                        return(-1);
                    }
                    else if (HyphenIndexB + 1 >= APostcodeB.Length)
                    {
                        return(1);
                    }

                    return(ComparePostcodes(APostcodeA.Substring(HyphenIndexA + 1), APostcodeB.Substring(HyphenIndexB + 1)));
                }
                else
                {
                    return(CompareSubstring);
                }
            }

            // change postcodes to uppercase
            APostcodeA = APostcodeA.ToUpper();
            APostcodeB = APostcodeB.ToUpper();

            while (true)
            {
                if ((APostcodeA.Length == 0) && (APostcodeB.Length == 0))
                {
                    return(0);
                }
                else if (APostcodeA.Length == 0)
                {
                    return(-1);
                }
                else if (APostcodeB.Length == 0)
                {
                    return(1);
                }

                int NumberIndexA  = APostcodeA.IndexOfAny("0123456789".ToCharArray());
                int NumberIndexB  = APostcodeB.IndexOfAny("0123456789".ToCharArray());
                int NumberLengthA = 0;
                int NumberLengthB = 0;
                int LetterIndexA  = APostcodeA.IndexOfAny("ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray());
                int LetterIndexB  = APostcodeB.IndexOfAny("ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray());
                int LetterLengthA = 0;
                int LetterLengthB = 0;

                // if one postcode starts with a number but the other starts with a letter
                if ((NumberIndexA == 0) && (NumberIndexB != 0))
                {
                    return(-1);
                }
                else if ((NumberIndexA != 0) && (NumberIndexB == 0))
                {
                    return(1);
                }

                // if both postcodes begin with a number
                if ((NumberIndexA == 0) && (NumberIndexB == 0))
                {
                    // find character indexs and lengths
                    if (LetterIndexA == -1)
                    {
                        NumberLengthA = APostcodeA.Length;
                    }
                    else
                    {
                        NumberLengthA = LetterIndexA;
                    }

                    if (LetterIndexB == -1)
                    {
                        NumberLengthB = APostcodeA.Length;
                    }
                    else
                    {
                        NumberLengthB = LetterIndexB;
                    }

                    // compare the beginning number
                    ReturnValue =
                        Convert.ToInt64(APostcodeA.Substring(0, NumberLengthA)).CompareTo(Convert.ToInt64(APostcodeB.Substring(0, NumberLengthB)));

                    if (ReturnValue != 0)
                    {
                        return(ReturnValue);
                    }

                    // if numbers are equal...
                    for (int i = LetterIndexA; i < APostcodeA.Length; i++)
                    {
                        if (char.IsNumber(APostcodeA[i]))
                        {
                            break;
                        }

                        LetterLengthA++;
                    }

                    for (int i = LetterIndexB; i < APostcodeB.Length; i++)
                    {
                        if (char.IsNumber(APostcodeB[i]))
                        {
                            break;
                        }

                        LetterLengthB++;
                    }

                    // compare letters
                    ReturnValue = APostcodeA.Substring(LetterIndexA, LetterLengthA).CompareTo(APostcodeB.Substring(LetterIndexB, LetterLengthB));

                    if (ReturnValue != 0)
                    {
                        return(ReturnValue);
                    }

                    // if letters are equal...
                    APostcodeA = APostcodeA.Substring(NumberLengthA + LetterLengthA);
                    APostcodeB = APostcodeB.Substring(NumberLengthB + LetterLengthB);
                }
                // if bothe postcodes start with a letter
                else if ((LetterIndexA == 0) && (LetterIndexB == 0))
                {
                    // find character indexs and lengths
                    if (NumberIndexA == -1)
                    {
                        LetterLengthA = APostcodeA.Length;
                    }
                    else
                    {
                        LetterLengthA = NumberIndexA;
                    }

                    if (NumberIndexB == -1)
                    {
                        LetterLengthB = APostcodeB.Length;
                    }
                    else
                    {
                        LetterLengthB = NumberIndexB;
                    }

                    // compare the beginning letters
                    ReturnValue = APostcodeA.Substring(0, LetterLengthA).CompareTo(APostcodeB.Substring(0, LetterLengthB));

                    if (ReturnValue != 0)
                    {
                        return(ReturnValue);
                    }

                    // if letters are equal...
                    for (int i = NumberIndexA; i < APostcodeA.Length; i++)
                    {
                        if (!char.IsNumber(APostcodeA[i]))
                        {
                            break;
                        }

                        NumberLengthA++;
                    }

                    for (int i = NumberIndexB; i < APostcodeB.Length; i++)
                    {
                        if (!char.IsNumber(APostcodeB[i]))
                        {
                            break;
                        }

                        NumberLengthB++;
                    }

                    // compare number
                    ReturnValue =
                        Convert.ToInt64(APostcodeA.Substring(NumberIndexA,
                                                             NumberLengthA)).CompareTo(Convert.ToInt64(APostcodeB.Substring(NumberIndexB, NumberLengthB)));

                    if (ReturnValue != 0)
                    {
                        return(ReturnValue);
                    }

                    // if numbers are equal...
                    APostcodeA = APostcodeA.Substring(NumberLengthA + LetterLengthA);
                    APostcodeB = APostcodeB.Substring(NumberLengthB + LetterLengthB);
                }
            }
        }
 /// <summary>
 ///     A T extension method that check if the value is between (exclusif) the minValue and maxValue.
 /// </summary>
 /// <param name="this">The @this to act on.</param>
 /// <param name="minValue">The minimum value.</param>
 /// <param name="maxValue">The maximum value.</param>
 /// <returns>true if the value is between the minValue and maxValue, otherwise false.</returns>
 /// ###
 /// <typeparam name="T">Generic type parameter.</typeparam>
 public static bool Between(this Int64 @this, Int64 minValue, Int64 maxValue)
 {
     return(minValue.CompareTo(@this) == -1 && @this.CompareTo(maxValue) == -1);
 }
Exemplo n.º 24
0
 /// <summary>比较</summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public Int32 CompareTo(Block other) => Position.CompareTo(other.Position);
Exemplo n.º 25
0
 public static Int64 of(Int64 left, Int64 right)
 {
     return(left.CompareTo(right) < 0 ? right : left);
 }
Exemplo n.º 26
0
 public Int32 CompareTo(CastRoom other)
 => roomName.CompareTo(other.roomName).notZero()
 ?? roomId.CompareTo(other.roomId);
Exemplo n.º 27
0
 private static int DateTimeComparer(Int64 a, Int64 b)
 {
     return(b.CompareTo(a));
 }
Exemplo n.º 28
0
    public static void Main()
    {
        string nl  = Environment.NewLine;
        string msg = "{0}The following is the result of using the generic and non-generic{0}" +
                     "versions of the CompareTo method for several base types:{0}";

        DateTime now = DateTime.Now;
// Time span = 11 days, 22 hours, 33 minutes, 44 seconds
        TimeSpan tsX = new TimeSpan(11, 22, 33, 44);
// Version = 1.2.333.4
        Version versX = new Version("1.2.333.4");
// Guid = CA761232-ED42-11CE-BACD-00AA0057B223
        Guid guidX = new Guid("{CA761232-ED42-11CE-BACD-00AA0057B223}");

        Boolean  a1 = true, a2 = true;
        Byte     b1 = 1, b2 = 1;
        Int16    c1 = -2, c2 = 2;
        Int32    d1 = 3, d2 = 3;
        Int64    e1 = 4, e2 = -4;
        Decimal  f1 = -5.5m, f2 = 5.5m;
        Single   g1 = 6.6f, g2 = 6.6f;
        Double   h1 = 7.7d, h2 = -7.7d;
        Char     i1 = 'A', i2 = 'A';
        String   j1 = "abc", j2 = "abc";
        DateTime k1 = now, k2 = now;
        TimeSpan l1 = tsX, l2 = tsX;
        Version  m1 = versX, m2 = new Version("2.0");
        Guid     n1 = guidX, n2 = guidX;

// The following types are not CLS-compliant.
        SByte  w1 = 8, w2 = 8;
        UInt16 x1 = 9, x2 = 9;
        UInt32 y1 = 10, y2 = 10;
        UInt64 z1 = 11, z2 = 11;

//
        Console.WriteLine(msg, nl);
        try
        {
// The second and third Show method call parameters are automatically boxed because
// the second and third Show method declaration arguments expect type Object.

            Show("Boolean:  ", a1, a2, a1.CompareTo(a2), a1.CompareTo((Object)a2));
            Show("Byte:     ", b1, b2, b1.CompareTo(b2), b1.CompareTo((Object)b2));
            Show("Int16:    ", c1, c2, c1.CompareTo(c2), c1.CompareTo((Object)c2));
            Show("Int32:    ", d1, d2, d1.CompareTo(d2), d1.CompareTo((Object)d2));
            Show("Int64:    ", e1, e2, e1.CompareTo(e2), e1.CompareTo((Object)e2));
            Show("Decimal:  ", f1, f2, f1.CompareTo(f2), f1.CompareTo((Object)f2));
            Show("Single:   ", g1, g2, g1.CompareTo(g2), g1.CompareTo((Object)g2));
            Show("Double:   ", h1, h2, h1.CompareTo(h2), h1.CompareTo((Object)h2));
            Show("Char:     ", i1, i2, i1.CompareTo(i2), i1.CompareTo((Object)i2));
            Show("String:   ", j1, j2, j1.CompareTo(j2), j1.CompareTo((Object)j2));
            Show("DateTime: ", k1, k2, k1.CompareTo(k2), k1.CompareTo((Object)k2));
            Show("TimeSpan: ", l1, l2, l1.CompareTo(l2), l1.CompareTo((Object)l2));
            Show("Version:  ", m1, m2, m1.CompareTo(m2), m1.CompareTo((Object)m2));
            Show("Guid:     ", n1, n2, n1.CompareTo(n2), n1.CompareTo((Object)n2));
//
            Console.WriteLine("{0}The following types are not CLS-compliant:", nl);
            Show("SByte:    ", w1, w2, w1.CompareTo(w2), w1.CompareTo((Object)w2));
            Show("UInt16:   ", x1, x2, x1.CompareTo(x2), x1.CompareTo((Object)x2));
            Show("UInt32:   ", y1, y2, y1.CompareTo(y2), y1.CompareTo((Object)y2));
            Show("UInt64:   ", z1, z2, z1.CompareTo(z2), z1.CompareTo((Object)z2));
        }
        catch (Exception e)
        {
            Console.WriteLine(e);
        }
    }
Exemplo n.º 29
0
    public virtual bool runTest()
    {
        Console.Error.WriteLine("Co1118CompareTo  runTest() started.");
        String        strLoc          = "Loc_000oo";
        StringBuilder sblMsg          = new StringBuilder(99);
        int           iCountErrors    = 0;
        int           iCountTestcases = 0;
        long          lo8b            = -12;
        Int64         int8a           = 55;

        try
        {
LABEL_860_GENERAL:
            do
            {
                strLoc = "Loc_120au";
                strLoc = "Loc_121eu";
                lo8b   = -12;
                lo8b   = int8a.CompareTo((Int64)66);
                ++iCountTestcases;
                if (!(lo8b < 0))
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK:  Error Err_337uf!  lo8b==" + lo8b);
                }
                strLoc = "Loc_122fu";
                lo8b   = -12;
                lo8b   = int8a.CompareTo(55L);
                ++iCountTestcases;
                if (!(lo8b == -0))
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK:  Error Err_248ak!  lo8b==" + lo8b);
                }
                strLoc = "Loc_123gu";
                lo8b   = -12;
                lo8b   = int8a.CompareTo((Int64)(-77));
                ++iCountTestcases;
                if (!(lo8b > 0))
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK:  Error Err_411wq!  lo8b==" + lo8b);
                }
                strLoc = "Loc_201ax";
                lo8b   = -12;
                lo8b   = int8a.CompareTo(null);
                ++iCountTestcases;
                if (!(lo8b > 0))
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK:  Error Err_713tw!  lo8b==" + lo8b);
                }
                strLoc = "Loc_202bx";
                lo8b   = -12;
                lo8b   = int8a.CompareTo((Type)null);
                ++iCountTestcases;
                if (!(lo8b > 0))
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK:  Error Err_714rw!  lo8b==" + lo8b);
                }
                strLoc = "Loc_301zv";
                lo8b   = -12;
                lo8b   = (Int64.MinValue).CompareTo((Int64.MinValue + 1));
                ++iCountTestcases;
                if (!(lo8b < 0))
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK:  Error Err_958je!  lo8b==" + lo8b);
                }
                strLoc = "Loc_303uv";
                Console.Error.WriteLine("Info Inf_774dx.  (Integer8.MinValue-Integer8.MaxValue)==" + unchecked (Int64.MinValue - Int64.MaxValue));
                strLoc = "Loc_302yv";
                lo8b   = -12;
                lo8b   = (Int64.MinValue).CompareTo(Int64.MaxValue);
                ++iCountTestcases;
                if (!(lo8b < 0))
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK:  Error Err_842sc!  lo8b==" + lo8b);
                }
                strLoc = "Loc_400hh";
                strLoc = "Loc_401ih";
                try
                {
                    ++iCountTestcases;
                    lo8b = -12;
                    lo8b = int8a.CompareTo((Int16)22);
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK:  Error Err_522yh!  lo8b==" + lo8b);
                }
                catch (ArgumentException argexc)
                {}
                catch (Exception excep1)
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK:  Error Err_636pi!  excep1==" + excep1);
                }
                strLoc = "Loc_402jh";
                try
                {
                    ++iCountTestcases;
                    lo8b = -12;
                    lo8b = int8a.CompareTo(22);
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK:  Error Err_452yh!  lo8b==" + lo8b);
                }
                catch (ArgumentException argexc)
                {}
                catch (Exception excep1)
                {
                    ++iCountErrors;
                    Console.Error.WriteLine("POINTTOBREAK:  Error Err_796pi!  excep1==" + excep1);
                }
            } while (false);
        }
        catch (Exception exc_general)
        {
            ++iCountErrors;
            Console.Error.WriteLine("POINTTOBREAK: Error Err_343un! (Co1118CompareTo) exc_general==" + exc_general);
            Console.Error.WriteLine("EXTENDEDINFO: (Err_343un) strLoc==" + strLoc);
        }
        if (iCountErrors == 0)
        {
            Console.Error.WriteLine("paSs.   Integer8\\Co1118CompareTo.cs   iCountTestcases==" + iCountTestcases);
            return(true);
        }
        else
        {
            Console.Error.WriteLine("FAiL!   Integer8\\Co1118CompareTo.cs   iCountErrors==" + iCountErrors);
            return(false);
        }
    }
Exemplo n.º 30
0
 private static void Compare_Int64(Int64 a, Int64 b) =>
 AssertEquals(a.CompareTo(b), Comparer <Int64> .Default.Compare(a, b));