using System.Text; using PepLib.Codes; using PepLib.Models; using Xunit; namespace PepLib.Core.Tests.IO; public class ProgramReaderTests { // ProgramReader reads fixed 200-byte ASCII records (no newlines), matching // the raw record format found inside real .pep loop entries. private const int RecordSize = 200; private static Stream RecordStream(params string[] lines) { var sb = new StringBuilder(); foreach (var line in lines) sb.Append(line.PadRight(RecordSize)); return new MemoryStream(Encoding.ASCII.GetBytes(sb.ToString())); } [Fact] public void Load_LinearMoveWithScribeMarker_SetsTypeToScribe() { using var stream = RecordStream("N50G1X1Y0:SCRIBE"); var program = Program.Load(stream); var move = Assert.IsType(Assert.Single(program)); Assert.Equal(EntityType.Scribe, move.Type); } [Fact] public void Load_CircularMoveWithScribeMarker_SetsTypeToScribe() { using var stream = RecordStream("N50G2X1Y0I0.5J0:SCRIBE"); var program = Program.Load(stream); var move = Assert.IsType(Assert.Single(program)); Assert.Equal(EntityType.Scribe, move.Type); } }