Beispiel #1
0
        private static void Main(string[] args)
        {
            Console.WriteLine("F0.Common");
            Console.WriteLine();

            int integer = GetInteger(args);

            Console.WriteLine($"{nameof(integer)} {integer} is {(Parity.IsEven(integer) ? "" : "not ")}even.");
            Console.WriteLine($"{nameof(integer)} {integer} is {(Parity.IsOdd(integer) ? "" : "not ")}odd.");
            Console.WriteLine();

            const int min = -240;
            const int max = +240;

            Console.WriteLine($"{nameof(integer)} {integer} clamped to the inclusive range of {min} and {max}:");
            Console.WriteLine(Comparable.Clamp(integer, min, max));
        }
Beispiel #2
0
 public void IfAnIntegerIsEvenlyDivisibleByTwo_ItIsEven_LeavingNoRemainder(int integer)
 {
     Assert.True(Parity.IsEven(integer));
     Assert.False(Parity.IsOdd(integer));
 }
Beispiel #3
0
 public void Even_16bitSignedInteger(short integer)
 {
     Assert.True(Parity.IsEven(integer));
     Assert.False(Parity.IsOdd(integer));
 }
Beispiel #4
0
 public void Odd_16bitUnsignedInteger(ushort integer)
 {
     Assert.True(Parity.IsOdd(integer));
     Assert.False(Parity.IsEven(integer));
 }
Beispiel #5
0
 public void Odd_NativeSizedUnsignedInteger(nuint integer)
 {
     Assert.True(Parity.IsOdd(integer));
     Assert.False(Parity.IsEven(integer));
 }
Beispiel #6
0
 public void Odd_8bitUnsignedInteger(byte integer)
 {
     Assert.True(Parity.IsOdd(integer));
     Assert.False(Parity.IsEven(integer));
 }
Beispiel #7
0
 public void Even_NativeSizedSignedInteger(nint integer)
 {
     Assert.True(Parity.IsEven(integer));
     Assert.False(Parity.IsOdd(integer));
 }
Beispiel #8
0
 public void Odd_64bitUnsignedInteger(ulong integer)
 {
     Assert.True(Parity.IsOdd(integer));
     Assert.False(Parity.IsEven(integer));
 }
Beispiel #9
0
 public void Even_64bitSignedInteger(long integer)
 {
     Assert.True(Parity.IsEven(integer));
     Assert.False(Parity.IsOdd(integer));
 }
Beispiel #10
0
 public void Even_8bitSignedInteger(sbyte integer)
 {
     Assert.True(Parity.IsEven(integer));
     Assert.False(Parity.IsOdd(integer));
 }
Beispiel #11
0
 public void Even_32bitUnsignedInteger(uint integer)
 {
     Assert.True(Parity.IsEven(integer));
     Assert.False(Parity.IsOdd(integer));
 }