public void TestUInt32() { UInt32 v = 1; for (var i = 0; i < (sizeof(UInt32) * 8) - 1; i++) { v.Rol(); var a = (UInt32)((UInt32)1 << (i + 1)); _output?.WriteLine(Convert.ToString(a, 2).PadLeft(32, '0') + " == " + Convert.ToString(v, 2).PadLeft(32, '0')); Assert.Equal(a, v); } v.Rol(); _output?.WriteLine(Convert.ToString(1, 2).PadLeft(32, '0') + " == " + Convert.ToString((UInt32)((UInt32)v), 2).PadLeft(32, '0')); Assert.Equal((UInt32)1, (UInt32)(UInt32)v); }
public void TestUInt32() { for (var i = 0; i < (sizeof(UInt32) * 8); i++) { UInt32 v = 1; v.Rol(i); var a = (UInt32)((UInt32)1 << (i)); _output?.WriteLine(Convert.ToString(a, 2).PadLeft(32, '0') + " == " + Convert.ToString(v, 2).PadLeft(32, '0')); Assert.Equal(a, v); } }