(byte[] input)
| 248 | } |
| 249 | |
| 250 | private static byte[] CaseBuffer(byte[] input) |
| 251 | { |
| 252 | ByteReader reader = new(input); |
| 253 | Ensure(reader.ReadUInt8() == 1, "bool mismatch"); |
| 254 | Ensure(reader.ReadInt8() == sbyte.MaxValue, "byte mismatch"); |
| 255 | Ensure(reader.ReadInt16() == short.MaxValue, "int16 mismatch"); |
| 256 | Ensure(reader.ReadInt32() == int.MaxValue, "int32 mismatch"); |
| 257 | Ensure(reader.ReadInt64() == long.MaxValue, "int64 mismatch"); |
| 258 | Ensure(Math.Abs(reader.ReadFloat32() - (-1.1f)) < 0.0001f, "float32 mismatch"); |
| 259 | Ensure(Math.Abs(reader.ReadFloat64() - (-1.1d)) < 0.000001d, "float64 mismatch"); |
| 260 | Ensure(reader.ReadVarUInt32() == 100, "varuint32 mismatch"); |
| 261 | int size = reader.ReadInt32(); |
| 262 | byte[] payload = reader.ReadBytes(size); |
| 263 | Ensure(payload.SequenceEqual("ab"u8.ToArray()), "binary mismatch"); |
| 264 | Ensure(reader.Remaining == 0, "buffer should be fully consumed"); |
| 265 | |
| 266 | ByteWriter writer = new(); |
| 267 | writer.WriteUInt8(1); |
| 268 | writer.WriteInt8(sbyte.MaxValue); |
| 269 | writer.WriteInt16(short.MaxValue); |
| 270 | writer.WriteInt32(int.MaxValue); |
| 271 | writer.WriteInt64(long.MaxValue); |
| 272 | writer.WriteFloat32(-1.1f); |
| 273 | writer.WriteFloat64(-1.1d); |
| 274 | writer.WriteVarUInt32(100); |
| 275 | writer.WriteInt32(2); |
| 276 | writer.WriteBytes("ab"u8); |
| 277 | return writer.ToArray(); |
| 278 | } |
| 279 | |
| 280 | private static byte[] CaseBufferVar(byte[] input) |
| 281 | { |
nothing calls this directly
no test coverage detected