Build PepApi image / build-and-push (push) Successful in 45s
DrawLoop previously drew every entity onto the single loop layer, so scribe/display marks were indistinguishable from cuts in the exported DXF. Non-cut entity types now get their own layer, and ProgramReader now parses the SCRIBE marker into EntityType.Scribe so scribed moves route to their own layer instead of falling through as untyped cuts. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
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<LinearMove>(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<CircularMove>(Assert.Single(program));
|
|
Assert.Equal(EntityType.Scribe, move.Type);
|
|
}
|
|
}
|