mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-10 05:15:43 +00:00
Compare commits
1 Commits
1aa45ff777
...
b0ae83ebf7
Author | SHA1 | Date | |
---|---|---|---|
|
b0ae83ebf7 |
@ -35,7 +35,7 @@ internal class DecimalTests
|
|||||||
byte[] expected = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 210];
|
byte[] expected = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 210];
|
||||||
|
|
||||||
Span<byte> bytes = stackalloc byte[16];
|
Span<byte> bytes = stackalloc byte[16];
|
||||||
Assert.That(value.TryWriteBigEndianBytes(bytes));
|
value.TryWriteBigEndianBytes(bytes);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expected, bytes.ToArray());
|
CollectionAssert.AreEqual(expected, bytes.ToArray());
|
||||||
}
|
}
|
||||||
@ -47,26 +47,8 @@ internal class DecimalTests
|
|||||||
byte[] expected = [210, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
byte[] expected = [210, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||||
|
|
||||||
Span<byte> bytes = stackalloc byte[16];
|
Span<byte> bytes = stackalloc byte[16];
|
||||||
Assert.That(value.TryWriteLittleEndianBytes(bytes));
|
value.TryWriteLittleEndianBytes(bytes);
|
||||||
|
|
||||||
CollectionAssert.AreEqual(expected, bytes.ToArray());
|
CollectionAssert.AreEqual(expected, bytes.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TryWriteBigEndianBytes_ShouldReturnFalse_GivenSmallSpan()
|
|
||||||
{
|
|
||||||
const decimal value = 1234m;
|
|
||||||
|
|
||||||
Span<byte> bytes = Span<byte>.Empty;
|
|
||||||
Assert.That(value.TryWriteBigEndianBytes(bytes), Is.False);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TryWriteLittleEndianBytes_ShouldReturnFalse_GivenSmallSpan()
|
|
||||||
{
|
|
||||||
const decimal value = 1234m;
|
|
||||||
|
|
||||||
Span<byte> bytes = Span<byte>.Empty;
|
|
||||||
Assert.That(value.TryWriteLittleEndianBytes(bytes), Is.False);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user