public void TestUInt64() { UInt64 v1 = 0b1001_1001; UInt64 i1 = 0b0000_0010; UInt64 a1 = 0b1001_0001; var v1b = v1; var v1a = v1.PackCopy(5, 2, i1); Assert.Equal(v1b, v1); Assert.Equal(a1.ToBitStringPadded(), v1a.ToBitStringPadded()); for (var i = 0; i < Iterations; i++) { var v = _rnd.NextUInt64(); var sv = _rnd.NextUInt64(); for (var offset = 1; offset < sizeof(UInt64) * 8; offset++) { for (var len = 1; len < offset; len++) { var ov = v; v = v.PackCopy(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); } } } }