From 7adcf731c9be62148ef529bbab3d254391ea2e47 Mon Sep 17 00:00:00 2001 From: FreePhoenix Date: Thu, 5 Aug 2021 15:44:19 +0600 Subject: [PATCH] Add maxValue >> 1 tests --- csharp/Platform.Numbers.Tests/BitTests.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/csharp/Platform.Numbers.Tests/BitTests.cs b/csharp/Platform.Numbers.Tests/BitTests.cs index fd82954..98237cc 100644 --- a/csharp/Platform.Numbers.Tests/BitTests.cs +++ b/csharp/Platform.Numbers.Tests/BitTests.cs @@ -1,4 +1,5 @@ using System; +using Platform.Reflection; using Xunit; namespace Platform.Numbers.Tests @@ -23,6 +24,7 @@ public static void ByteBitwiseOperationsTest() Assert.True(Bit.And(1, 2) == (1 & 2)); Assert.True(Bit.ShiftLeft(1, 2) == (1 << 2)); Assert.True(Bit.ShiftRight(1, 2) == (1 >> 2)); + Assert.Equal(NumericType.MaxValue >> 1, Bit.ShiftRight(NumericType.MaxValue, 1)); } [Fact] @@ -33,6 +35,7 @@ public static void UInt16BitwiseOperationsTest() Assert.True(Bit.And(1, 2) == (1 & 2)); Assert.True(Bit.ShiftLeft(1, 2) == (1 << 2)); Assert.True(Bit.ShiftRight(1, 2) == (1 >> 2)); + Assert.Equal(NumericType.MaxValue >> 1, Bit.ShiftRight(NumericType.MaxValue, 1)); } [Fact] @@ -43,6 +46,7 @@ public static void UInt32BitwiseOperationsTest() Assert.True(Bit.And(1, 2) == (1 & 2)); Assert.True(Bit.ShiftLeft(1, 2) == (1 << 2)); Assert.True(Bit.ShiftRight(1, 2) == (1 >> 2)); + Assert.Equal(NumericType.MaxValue >> 1, Bit.ShiftRight(NumericType.MaxValue, 1)); } [Fact] @@ -53,6 +57,7 @@ public static void UInt64BitwiseOperationsTest() Assert.True(Bit.And(1, 2) == (1 & 2)); Assert.True(Bit.ShiftLeft(1, 2) == (1 << 2)); Assert.True(Bit.ShiftRight(1, 2) == (1 >> 2)); + Assert.Equal(NumericType.MaxValue >> 1, Bit.ShiftRight(NumericType.MaxValue, 1)); } [Fact]