Skip to content

Commit e370290

Browse files
committed
Fix bug with updating property value bytes incorrectly
1 parent 086c46c commit e370290

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

ZMachineLib.Feature.Tests/ZMachineFeatureTester.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public ZMachineFeatureTester Execute(string command, string outputContains = "")
7373
.ToArray())
7474
);
7575

76-
var customMessage = $"Last command ('{_lastCommand}') had an expectation of '{outputString}' that was not met by :\n" +
76+
var customMessage = $"Last command ('{_lastCommand}') expected a response containing '{outputString}'!\nResponse:\n" +
7777
$"{_outputBetweenCommands}";
7878
// Assert.True(lastExpectationMet, customMessage);
7979
lastExpectationMet.ShouldBeTrue(customMessage);

ZMachineLib/Content/ZProperty.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
using ZMachineLib.Managers;
1+
using System.Diagnostics;
2+
using ZMachineLib.Managers;
23

34
namespace ZMachineLib.Content
45
{
6+
[DebuggerDisplay("{Number}")]
57
public class ZProperty
68
{
79
private readonly IMemoryManager _manager;

ZMachineLib/Extensions/ByteHandlingExtensions.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,12 @@ public static uint GetUInt(this Span<byte> bytes)
6868
public static byte FromBitNumber(this byte bitNumber)
6969
=> (byte) (1 << bitNumber);
7070

71-
public static byte[] ToByteArray(this ushort value)
72-
{
73-
var result = new byte[2];
74-
75-
result[0] = (byte) value;
76-
result[1] = (byte) (value >> 8);
77-
78-
return result;
79-
}
71+
public static byte[] ToByteArray(this ushort value)
72+
=> new byte[2]
73+
{
74+
(byte) (value >> 8),
75+
(byte) value
76+
};
8077

8178
public static byte[] ToByteArray(this Stream stream)
8279
{

0 commit comments

Comments
 (0)