Files
OpenNest/OpenNest.Tests/CNC/VariableDefinitionTests.cs
AJ Isaacs 1040db414f feat: add VariableDefinition type for G-code user variables
Adds immutable VariableDefinition record to OpenNest.CNC with name,
expression, resolved value, inline, and global flags. Fixes namespace
collision in PatternTilerTests and PolygonHelperTests caused by the new
OpenNest.Tests.CNC namespace.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-02 09:46:37 -04:00

34 lines
823 B
C#

using OpenNest.CNC;
namespace OpenNest.Tests.CNC;
public class VariableDefinitionTests
{
[Fact]
public void Constructor_SetsAllProperties()
{
var v = new VariableDefinition("diameter", "0.3", 0.3);
Assert.Equal("diameter", v.Name);
Assert.Equal("0.3", v.Expression);
Assert.Equal(0.3, v.Value);
Assert.False(v.Inline);
Assert.False(v.Global);
}
[Fact]
public void Constructor_WithFlags_SetsFlags()
{
var v = new VariableDefinition("width", "48.0", 48.0, inline: true, global: true);
Assert.True(v.Inline);
Assert.True(v.Global);
}
[Fact]
public void DefaultFlags_AreFalse()
{
var v = new VariableDefinition("x", "1", 1.0);
Assert.False(v.Inline);
Assert.False(v.Global);
}
}