コード例 #1
0
ファイル: RuneTests.cs プロジェクト: lateralusX/runtime
        public static void CompareTo_And_ComparisonOperators(int first, int other, int expectedSign)
        {
            Rune a = new Rune(first);
            Rune b = new Rune(other);

            Assert.Equal(expectedSign, Math.Sign(a.CompareTo(b)));
            Assert.Equal(expectedSign < 0, a < b);
            Assert.Equal(expectedSign <= 0, a <= b);
            Assert.Equal(expectedSign > 0, a > b);
            Assert.Equal(expectedSign >= 0, a >= b);
        }
コード例 #2
0
ファイル: RuneTests.cs プロジェクト: lateralusX/runtime
        public static void Operators_And_CompareTo(uint scalarValueLeft, uint scalarValueRight)
        {
            Rune left  = new Rune(scalarValueLeft);
            Rune right = new Rune(scalarValueRight);

            Assert.Equal(scalarValueLeft == scalarValueRight, left == right);
            Assert.Equal(scalarValueLeft != scalarValueRight, left != right);
            Assert.Equal(scalarValueLeft < scalarValueRight, left < right);
            Assert.Equal(scalarValueLeft <= scalarValueRight, left <= right);
            Assert.Equal(scalarValueLeft > scalarValueRight, left > right);
            Assert.Equal(scalarValueLeft >= scalarValueRight, left >= right);
            Assert.Equal(scalarValueLeft.CompareTo(scalarValueRight), left.CompareTo(right));
        }
コード例 #3
0
ファイル: RuneTests.cs プロジェクト: layomia/dotnet_runtime
        public static void NonGenericCompareTo_GivenNonRuneArgument_ThrowsArgumentException()
        {
            IComparable rune = new Rune(0);

            Assert.Throws <ArgumentException>(() => rune.CompareTo(0 /* int32 */));
        }