EightBitNet/LR35902/LR35902.FuseTest/Test.cs
Adrian Conlon ed92ce33f6 Starting to port Fuse test runner for LR35902 emulator. Not running yet.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
2019-07-19 23:59:32 +01:00

46 lines
1.2 KiB
C#

namespace Fuse
{
using System.Collections.Generic;
using System.IO;
public class Test
{
public bool Valid => !string.IsNullOrEmpty(this.Description);
public string Description { get; private set; }
public RegisterState RegisterState { get; } = new RegisterState();
public List<MemoryDatum> MemoryData { get; } = new List<MemoryDatum>();
public void Read(StreamReader file)
{
while ((string.IsNullOrWhiteSpace(this.Description) || this.Description.StartsWith(";")) && !file.EndOfStream)
{
this.Description = file.ReadLine();
}
if (!this.Valid)
{
return;
}
this.RegisterState.Read(file);
var finished = false;
do
{
var line = file.ReadLine();
finished = line == "-1";
if (!finished)
{
var datum = new MemoryDatum();
datum.Parse(line);
this.MemoryData.Add(datum);
}
}
while (!finished);
}
}
}