public void TestEncodeDecodeUInt32() { var values = new uint[32 * 2]; for (var i = 1; i < 32; i++) { var value = (uint)Math.Pow(2, i); values[i * 2] = value - 1; values[i * 2 + 1] = value; } var buffer = stackalloc byte[5]; for (var i = 0; i < values.Length; i++) { var p = buffer; Codec.EncodeUInt32(values[i], ref p); p = buffer; var value = Codec.DecodeUInt32(ref p); Assert.AreEqual(values[i], value, "At idx: " + i); } }