Skip to content

Commit

Permalink
Add maxValue >> 1 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
FreePhoenix888 committed Aug 5, 2021
1 parent 8583ec3 commit 7adcf73
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions csharp/Platform.Numbers.Tests/BitTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Platform.Reflection;
using Xunit;

namespace Platform.Numbers.Tests
Expand All @@ -23,6 +24,7 @@ public static void ByteBitwiseOperationsTest()
Assert.True(Bit<byte>.And(1, 2) == (1 & 2));
Assert.True(Bit<byte>.ShiftLeft(1, 2) == (1 << 2));
Assert.True(Bit<byte>.ShiftRight(1, 2) == (1 >> 2));
Assert.Equal(NumericType<byte>.MaxValue >> 1, Bit<byte>.ShiftRight(NumericType<byte>.MaxValue, 1));
}

[Fact]
Expand All @@ -33,6 +35,7 @@ public static void UInt16BitwiseOperationsTest()
Assert.True(Bit<ushort>.And(1, 2) == (1 & 2));
Assert.True(Bit<ushort>.ShiftLeft(1, 2) == (1 << 2));
Assert.True(Bit<ushort>.ShiftRight(1, 2) == (1 >> 2));
Assert.Equal(NumericType<ushort>.MaxValue >> 1, Bit<ushort>.ShiftRight(NumericType<ushort>.MaxValue, 1));
}

[Fact]
Expand All @@ -43,6 +46,7 @@ public static void UInt32BitwiseOperationsTest()
Assert.True(Bit<uint>.And(1, 2) == (1 & 2));
Assert.True(Bit<uint>.ShiftLeft(1, 2) == (1 << 2));
Assert.True(Bit<uint>.ShiftRight(1, 2) == (1 >> 2));
Assert.Equal(NumericType<uint>.MaxValue >> 1, Bit<uint>.ShiftRight(NumericType<uint>.MaxValue, 1));
}

[Fact]
Expand All @@ -53,6 +57,7 @@ public static void UInt64BitwiseOperationsTest()
Assert.True(Bit<ulong>.And(1, 2) == (1 & 2));
Assert.True(Bit<ulong>.ShiftLeft(1, 2) == (1 << 2));
Assert.True(Bit<ulong>.ShiftRight(1, 2) == (1 >> 2));
Assert.Equal(NumericType<ulong>.MaxValue >> 1, Bit<ulong>.ShiftRight(NumericType<ulong>.MaxValue, 1));
}

[Fact]
Expand Down

0 comments on commit 7adcf73

Please sign in to comment.