public void TestUInt32() { UInt32 v1 = 0b1001_1001; UInt32 i1 = 0b0000_0010; UInt32 a1 = 0b1001_0001; v1.Pack(5, 2, i1); Assert.Equal(a1.ToBitStringPadded(), v1.ToBitStringPadded()); for (var i = 0; i < Iterations; i++) { var v = _rnd.NextUInt32(); var sv = _rnd.NextUInt32(); for (var offset = 1; offset < sizeof(UInt32) * 8; offset++) { for (var len = 1; len < offset; len++) { var ov = v; v.Pack(offset, len, sv); var ss = sv.ToBitStringPadded(); ss = ss.Substring(ss.Length - len, len); var ovs = ov.ToBitStringPadded(); ovs = ovs.Substring(0, ovs.Length - offset) + ss + ovs.Substring(ovs.Length - offset + len); Assert.Equal(v.ToBitStringPadded(), ovs); //_outputHelper.WriteLine(ovs); } } } }