Skip to content

Next Gen STEP AP242 Native-ish BREP Geometric Modeling Kernel

Implement Firmament M1c validation required-field checks

Yuechen Li93e18528c572
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs
index 378862b6..abbb8a46 100644
--- a/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentScaffoldTests.cs
@@ -34,7 +34,7 @@ public sealed class FirmamentScaffoldTests
Assert.True(result.Compilation.IsSuccess);
var artifact = result.Compilation.Value;
- Assert.Equal("firmament-ops-primitive-and-boolean-required-fields-validated", artifact.ArtifactKind);
+ Assert.Equal("firmament-ops-primitive-boolean-and-validation-required-fields-validated", artifact.ArtifactKind);
Assert.NotNull(artifact.ParsedDocument);
Assert.Equal("1", artifact.ParsedDocument!.Firmament.Version);
Assert.Equal("demo", artifact.ParsedDocument.Model.Name);
@@ -158,7 +158,7 @@ public sealed class FirmamentScaffoldTests
"firmament": { "version": "1" },
"model": { "name": "demo", "units": "mm" },
"ops": [
- { "op": "expect_exists" }
+ { "op": "expect_exists", "target": "base" }
]
}
""",
@@ -623,6 +623,9 @@ public sealed class FirmamentScaffoldTests
"add" => "{ \"op\": \"add\", \"id\": \"a1\", \"to\": \"b1\", \"with\": { \"op\": \"sphere\" } }",
"subtract" => "{ \"op\": \"subtract\", \"id\": \"s1\", \"from\": \"b1\", \"with\": { \"op\": \"sphere\" } }",
"intersect" => "{ \"op\": \"intersect\", \"id\": \"i1\", \"left\": \"b1\", \"with\": { \"op\": \"sphere\" } }",
+ "expect_exists" => "{ \"op\": \"expect_exists\", \"target\": \"b1\" }",
+ "expect_selectable" => "{ \"op\": \"expect_selectable\", \"target\": \"b1\", \"count\": 1 }",
+ "expect_manifold" => "{ \"op\": \"expect_manifold\" }",
_ => $"{{ \"op\": \"{opName}\" }}"
};
diff --git a/Aetheris.Kernel.Firmament.Tests/FirmamentValidationRequiredFieldValidationTests.cs b/Aetheris.Kernel.Firmament.Tests/FirmamentValidationRequiredFieldValidationTests.cs
new file mode 100644
index 00000000..8ff44637
--- /dev/null
+++ b/Aetheris.Kernel.Firmament.Tests/FirmamentValidationRequiredFieldValidationTests.cs
@@ -0,0 +1,188 @@
+using Aetheris.Kernel.Firmament.Diagnostics;
+
+namespace Aetheris.Kernel.Firmament.Tests;
+
+public sealed class FirmamentValidationRequiredFieldValidationTests
+{
+ [Fact]
+ public void Compiler_Accepts_ValidExpectExists() =>
+ AssertValidationSuccess(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "expect_exists", "target": "base.top_face" }
+ ]
+ }
+ """);
+
+ [Fact]
+ public void Compiler_Accepts_ValidExpectSelectable() =>
+ AssertValidationSuccess(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "expect_selectable", "target": "hole", "count": 4 }
+ ]
+ }
+ """);
+
+ [Fact]
+ public void Compiler_Accepts_ValidExpectManifold_WithoutPayload() =>
+ AssertValidationSuccess(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "expect_manifold" }
+ ]
+ }
+ """);
+
+ [Fact]
+ public void Compiler_Rejects_ExpectExists_MissingTarget() =>
+ AssertValidationFailure(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "expect_exists" }
+ ]
+ }
+ """,
+ FirmamentDiagnosticCodes.ValidationMissingRequiredField,
+ "Validation op 'expect_exists' at index 0 is missing required field 'target'.");
+
+ [Fact]
+ public void Compiler_Rejects_ExpectSelectable_MissingTarget() =>
+ AssertValidationFailure(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "expect_selectable", "count": 2 }
+ ]
+ }
+ """,
+ FirmamentDiagnosticCodes.ValidationMissingRequiredField,
+ "Validation op 'expect_selectable' at index 0 is missing required field 'target'.");
+
+ [Fact]
+ public void Compiler_Rejects_ExpectSelectable_MissingCount() =>
+ AssertValidationFailure(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "expect_selectable", "target": "base" }
+ ]
+ }
+ """,
+ FirmamentDiagnosticCodes.ValidationMissingRequiredField,
+ "Validation op 'expect_selectable' at index 0 is missing required field 'count'.");
+
+ [Fact]
+ public void Compiler_Rejects_ExpectSelectable_NonNumericCount() =>
+ AssertValidationFailure(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "expect_selectable", "target": "base", "count": "many" }
+ ]
+ }
+ """,
+ FirmamentDiagnosticCodes.ValidationInvalidFieldTypeOrShape,
+ "Validation op 'expect_selectable' at index 0 has invalid field 'count'; expected a numeric scalar value.");
+
+ [Fact]
+ public void Compiler_Rejects_ExpectSelectable_NonIntegerCount() =>
+ AssertValidationFailure(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "expect_selectable", "target": "base", "count": 1.5 }
+ ]
+ }
+ """,
+ FirmamentDiagnosticCodes.ValidationInvalidFieldValue,
+ "Validation op 'expect_selectable' at index 0 has invalid field 'count' value; expected an integer-valued number greater than 0.");
+
+ [Fact]
+ public void Compiler_Rejects_ExpectSelectable_NonPositiveCount() =>
+ AssertValidationFailure(
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "expect_selectable", "target": "base", "count": 0 }
+ ]
+ }
+ """,
+ FirmamentDiagnosticCodes.ValidationInvalidFieldValue,
+ "Validation op 'expect_selectable' at index 0 has invalid field 'count' value; expected an integer-valued number greater than 0.");
+
+ [Fact]
+ public void Compiler_Rejects_ExpectSelectable_MissingCount_Deterministically()
+ {
+ var source =
+ """
+ {
+ "firmament": { "version": "1" },
+ "model": { "name": "demo", "units": "mm" },
+ "ops": [
+ { "op": "expect_selectable", "target": "base" }
+ ]
+ }
+ """;
+
+ var compiler = new FirmamentCompiler();
+ var first = compiler.Compile(new FirmamentCompileRequest(new FirmamentSourceDocument(source)));
+ var second = compiler.Compile(new FirmamentCompileRequest(new FirmamentSourceDocument(source)));
+
+ Assert.False(first.Compilation.IsSuccess);
+ Assert.False(second.Compilation.IsSuccess);
+
+ var firstDiagnostic = Assert.Single(first.Compilation.Diagnostics);
+ var secondDiagnostic = Assert.Single(second.Compilation.Diagnostics);
+
+ Assert.Equal(firstDiagnostic.Code, secondDiagnostic.Code);
+ Assert.Equal(firstDiagnostic.Severity, secondDiagnostic.Severity);
+ Assert.Equal(firstDiagnostic.Message, secondDiagnostic.Message);
+ Assert.Equal(firstDiagnostic.Source, secondDiagnostic.Source);
+ }
+
+ private static void AssertValidationSuccess(string source)
+ {
+ var compiler = new FirmamentCompiler();
+
+ var result = compiler.Compile(new FirmamentCompileRequest(new FirmamentSourceDocument(source)));
+
+ Assert.True(result.Compilation.IsSuccess);
+ Assert.NotNull(result.Compilation.Value.ParsedDocument);
+ }
+
+ private static void AssertValidationFailure(string source, FirmamentDiagnosticCode expectedCode, string expectedMessageSuffix)
+ {
+ var compiler = new FirmamentCompiler();
+
+ var result = compiler.Compile(new FirmamentCompileRequest(new FirmamentSourceDocument(source)));
+
+ Assert.False(result.Compilation.IsSuccess);
+ var diagnostic = Assert.Single(result.Compilation.Diagnostics);
+
+ Assert.Contains($"[{expectedCode.Value}]", diagnostic.Message, StringComparison.Ordinal);
+ Assert.EndsWith(expectedMessageSuffix, diagnostic.Message, StringComparison.Ordinal);
+ }
+}
diff --git a/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.cs b/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.cs
index 257701e6..ce65ef85 100644
--- a/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.cs
+++ b/Aetheris.Kernel.Firmament/Diagnostics/FirmamentDiagnosticCodes.cs
@@ -18,6 +18,9 @@ public static class FirmamentDiagnosticCodes
public static readonly FirmamentDiagnosticCode PrimitiveInvalidFieldValue = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0011");
public static readonly FirmamentDiagnosticCode BooleanMissingRequiredField = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0012");
public static readonly FirmamentDiagnosticCode BooleanInvalidFieldTypeOrShape = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0013");
+ public static readonly FirmamentDiagnosticCode ValidationMissingRequiredField = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0014");
+ public static readonly FirmamentDiagnosticCode ValidationInvalidFieldTypeOrShape = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0015");
+ public static readonly FirmamentDiagnosticCode ValidationInvalidFieldValue = new($"{FirmamentDiagnosticConventions.StructurePrefix}-0016");
public static readonly FirmamentDiagnosticCode ReferencePlaceholder = new($"{FirmamentDiagnosticConventions.ReferencePrefix}-0001");
public static readonly FirmamentDiagnosticCode SelectorPlaceholder = new($"{FirmamentDiagnosticConventions.SelectorPrefix}-0001");
diff --git a/Aetheris.Kernel.Firmament/FirmamentCompilationArtifact.cs b/Aetheris.Kernel.Firmament/FirmamentCompilationArtifact.cs
index 8350aaae..d13b6890 100644
--- a/Aetheris.Kernel.Firmament/FirmamentCompilationArtifact.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentCompilationArtifact.cs
@@ -3,5 +3,5 @@ using Aetheris.Kernel.Firmament.ParsedModel;
namespace Aetheris.Kernel.Firmament;
public sealed record FirmamentCompilationArtifact(
- string ArtifactKind = "firmament-ops-primitive-required-fields-validated",
+ string ArtifactKind = "firmament-ops-primitive-boolean-and-validation-required-fields-validated",
FirmamentParsedDocument? ParsedDocument = null);
diff --git a/Aetheris.Kernel.Firmament/FirmamentCompiler.cs b/Aetheris.Kernel.Firmament/FirmamentCompiler.cs
index b481cd4e..2a7875ca 100644
--- a/Aetheris.Kernel.Firmament/FirmamentCompiler.cs
+++ b/Aetheris.Kernel.Firmament/FirmamentCompiler.cs
@@ -31,10 +31,17 @@ public sealed class FirmamentCompiler
KernelResult<FirmamentCompilationArtifact>.Failure(booleanValidationResult.Diagnostics));
}
+ var validationValidationResult = FirmamentValidationRequiredFieldValidator.Validate(parseResult.Value);
+ if (!validationValidationResult.IsSuccess)
+ {
+ return new FirmamentCompileResult(
+ KernelResult<FirmamentCompilationArtifact>.Failure(validationValidationResult.Diagnostics));
+ }
+
return new FirmamentCompileResult(
KernelResult<FirmamentCompilationArtifact>.Success(
new FirmamentCompilationArtifact(
- ArtifactKind: "firmament-ops-primitive-and-boolean-required-fields-validated",
+ ArtifactKind: "firmament-ops-primitive-boolean-and-validation-required-fields-validated",
ParsedDocument: parseResult.Value)));
}
}
diff --git a/Aetheris.Kernel.Firmament/Validation/FirmamentValidationRequiredFieldValidator.cs b/Aetheris.Kernel.Firmament/Validation/FirmamentValidationRequiredFieldValidator.cs
new file mode 100644
index 00000000..57aa5246
--- /dev/null
+++ b/Aetheris.Kernel.Firmament/Validation/FirmamentValidationRequiredFieldValidator.cs
@@ -0,0 +1,157 @@
+using System.Globalization;
+using Aetheris.Kernel.Core.Diagnostics;
+using Aetheris.Kernel.Core.Results;
+using Aetheris.Kernel.Firmament.Diagnostics;
+using Aetheris.Kernel.Firmament.ParsedModel;
+
+namespace Aetheris.Kernel.Firmament.Validation;
+
+internal static class FirmamentValidationRequiredFieldValidator
+{
+ public static KernelResult<bool> Validate(FirmamentParsedDocument parsedDocument)
+ {
+ ArgumentNullException.ThrowIfNull(parsedDocument);
+
+ for (var index = 0; index < parsedDocument.Ops.Entries.Count; index++)
+ {
+ var entry = parsedDocument.Ops.Entries[index];
+ if (entry.Family != FirmamentOpFamily.Validation)
+ {
+ continue;
+ }
+
+ var validationResult = entry.KnownKind switch
+ {
+ FirmamentKnownOpKind.ExpectExists => ValidateExpectExists(entry, index),
+ FirmamentKnownOpKind.ExpectSelectable => ValidateExpectSelectable(entry, index),
+ FirmamentKnownOpKind.ExpectManifold => KernelResult<bool>.Success(true),
+ _ => KernelResult<bool>.Success(true)
+ };
+
+ if (!validationResult.IsSuccess)
+ {
+ return validationResult;
+ }
+ }
+
+ return KernelResult<bool>.Success(true);
+ }
+
+ private static KernelResult<bool> ValidateExpectExists(FirmamentParsedOpEntry entry, int opIndex)
+ {
+ if (!TryGetRequiredNonEmptyScalar(entry, "target", opIndex, out var missingOrTypeDiagnostic))
+ {
+ return KernelResult<bool>.Failure([missingOrTypeDiagnostic!]);
+ }
+
+ return KernelResult<bool>.Success(true);
+ }
+
+ private static KernelResult<bool> ValidateExpectSelectable(FirmamentParsedOpEntry entry, int opIndex)
+ {
+ if (!TryGetRequiredNonEmptyScalar(entry, "target", opIndex, out var missingOrTypeDiagnostic))
+ {
+ return KernelResult<bool>.Failure([missingOrTypeDiagnostic!]);
+ }
+
+ if (!entry.RawFields.TryGetValue("count", out var countRaw) || string.IsNullOrWhiteSpace(countRaw))
+ {
+ return MissingField("count", opIndex, entry.OpName);
+ }
+
+ if (!TryParseNumeric(countRaw, out var countValue))
+ {
+ return InvalidFieldType("count", opIndex, entry.OpName, "expected a numeric scalar value");
+ }
+
+ if (Math.Abs(countValue - Math.Round(countValue)) > 0)
+ {
+ return InvalidFieldValue("count", opIndex, entry.OpName, "expected an integer-valued number greater than 0");
+ }
+
+ if (countValue <= 0)
+ {
+ return InvalidFieldValue("count", opIndex, entry.OpName, "expected an integer-valued number greater than 0");
+ }
+
+ return KernelResult<bool>.Success(true);
+ }
+
+ private static bool TryGetRequiredNonEmptyScalar(FirmamentParsedOpEntry entry, string fieldName, int opIndex, out KernelDiagnostic? diagnostic)
+ {
+ diagnostic = null;
+
+ if (!entry.RawFields.TryGetValue(fieldName, out var raw) || string.IsNullOrWhiteSpace(raw))
+ {
+ diagnostic = MissingFieldDiagnostic(fieldName, opIndex, entry.OpName);
+ return false;
+ }
+
+ if (LooksLikeStructuredValue(raw))
+ {
+ diagnostic = InvalidFieldTypeDiagnostic(fieldName, opIndex, entry.OpName, "expected a non-empty scalar/string-like value");
+ return false;
+ }
+
+ return true;
+ }
+
+ private static bool LooksLikeStructuredValue(string raw)
+ {
+ var trimmed = raw.Trim();
+ return trimmed.StartsWith("{", StringComparison.Ordinal) || trimmed.StartsWith("[", StringComparison.Ordinal);
+ }
+
+ private static bool TryParseNumeric(string raw, out double value)
+ {
+ var trimmed = raw.Trim();
+ if (LooksLikeStructuredValue(trimmed))
+ {
+ value = default;
+ return false;
+ }
+
+ if (string.Equals(trimmed, "true", StringComparison.OrdinalIgnoreCase)
+ || string.Equals(trimmed, "false", StringComparison.OrdinalIgnoreCase))
+ {
+ value = default;
+ return false;
+ }
+
+ if (trimmed.StartsWith("\"", StringComparison.Ordinal) && trimmed.EndsWith("\"", StringComparison.Ordinal) && trimmed.Length >= 2)
+ {
+ trimmed = trimmed[1..^1];
+ }
+
+ return double.TryParse(trimmed, NumberStyles.Float, CultureInfo.InvariantCulture, out value);
+ }
+
+ private static KernelResult<bool> MissingField(string fieldName, int opIndex, string opName) =>
+ KernelResult<bool>.Failure([MissingFieldDiagnostic(fieldName, opIndex, opName)]);
+
+ private static KernelDiagnostic MissingFieldDiagnostic(string fieldName, int opIndex, string opName) =>
+ CreateDiagnostic(
+ FirmamentDiagnosticCodes.ValidationMissingRequiredField,
+ $"Validation op '{opName}' at index {opIndex} is missing required field '{fieldName}'.");
+
+ private static KernelResult<bool> InvalidFieldType(string fieldName, int opIndex, string opName, string expectation) =>
+ KernelResult<bool>.Failure([InvalidFieldTypeDiagnostic(fieldName, opIndex, opName, expectation)]);
+
+ private static KernelDiagnostic InvalidFieldTypeDiagnostic(string fieldName, int opIndex, string opName, string expectation) =>
+ CreateDiagnostic(
+ FirmamentDiagnosticCodes.ValidationInvalidFieldTypeOrShape,
+ $"Validation op '{opName}' at index {opIndex} has invalid field '{fieldName}'; {expectation}.");
+
+ private static KernelResult<bool> InvalidFieldValue(string fieldName, int opIndex, string opName, string expectation) =>
+ KernelResult<bool>.Failure(
+ [CreateDiagnostic(
+ FirmamentDiagnosticCodes.ValidationInvalidFieldValue,
+ $"Validation op '{opName}' at index {opIndex} has invalid field '{fieldName}' value; {expectation}.")]);
+
+ private static KernelDiagnostic CreateDiagnostic(FirmamentDiagnosticCode code, string message) =>
+ new(
+ KernelDiagnosticCode.ValidationFailed,
+ KernelDiagnosticSeverity.Error,
+ $"[{code.Value}] {message}",
+ FirmamentDiagnosticConventions.Source);
+}
diff --git a/testdata/firmament/fixtures/m1c-invalid-expect-exists-missing-target.firmament b/testdata/firmament/fixtures/m1c-invalid-expect-exists-missing-target.firmament
new file mode 100644
index 00000000..ad968e36
--- /dev/null
+++ b/testdata/firmament/fixtures/m1c-invalid-expect-exists-missing-target.firmament
@@ -0,0 +1,10 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: expect_exists
diff --git a/testdata/firmament/fixtures/m1c-invalid-expect-selectable-missing-count.firmament b/testdata/firmament/fixtures/m1c-invalid-expect-selectable-missing-count.firmament
new file mode 100644
index 00000000..1c5ef626
--- /dev/null
+++ b/testdata/firmament/fixtures/m1c-invalid-expect-selectable-missing-count.firmament
@@ -0,0 +1,11 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: expect_selectable
+ target: base
diff --git a/testdata/firmament/fixtures/m1c-invalid-expect-selectable-missing-target.firmament b/testdata/firmament/fixtures/m1c-invalid-expect-selectable-missing-target.firmament
new file mode 100644
index 00000000..96b8dd67
--- /dev/null
+++ b/testdata/firmament/fixtures/m1c-invalid-expect-selectable-missing-target.firmament
@@ -0,0 +1,11 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: expect_selectable
+ count: 2
diff --git a/testdata/firmament/fixtures/m1c-invalid-expect-selectable-non-integer-count.firmament b/testdata/firmament/fixtures/m1c-invalid-expect-selectable-non-integer-count.firmament
new file mode 100644
index 00000000..c0120349
--- /dev/null
+++ b/testdata/firmament/fixtures/m1c-invalid-expect-selectable-non-integer-count.firmament
@@ -0,0 +1,12 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: expect_selectable
+ target: base
+ count: 1.5
diff --git a/testdata/firmament/fixtures/m1c-invalid-expect-selectable-non-numeric-count.firmament b/testdata/firmament/fixtures/m1c-invalid-expect-selectable-non-numeric-count.firmament
new file mode 100644
index 00000000..546eeda3
--- /dev/null
+++ b/testdata/firmament/fixtures/m1c-invalid-expect-selectable-non-numeric-count.firmament
@@ -0,0 +1,12 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: expect_selectable
+ target: base
+ count: many
diff --git a/testdata/firmament/fixtures/m1c-invalid-expect-selectable-non-positive-count.firmament b/testdata/firmament/fixtures/m1c-invalid-expect-selectable-non-positive-count.firmament
new file mode 100644
index 00000000..8ff1c240
--- /dev/null
+++ b/testdata/firmament/fixtures/m1c-invalid-expect-selectable-non-positive-count.firmament
@@ -0,0 +1,12 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: expect_selectable
+ target: base
+ count: 0
diff --git a/testdata/firmament/fixtures/m1c-valid-expect-exists.firmament b/testdata/firmament/fixtures/m1c-valid-expect-exists.firmament
new file mode 100644
index 00000000..97f19112
--- /dev/null
+++ b/testdata/firmament/fixtures/m1c-valid-expect-exists.firmament
@@ -0,0 +1,11 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: expect_exists
+ target: base.top_face
diff --git a/testdata/firmament/fixtures/m1c-valid-expect-manifold.firmament b/testdata/firmament/fixtures/m1c-valid-expect-manifold.firmament
new file mode 100644
index 00000000..acf55abf
--- /dev/null
+++ b/testdata/firmament/fixtures/m1c-valid-expect-manifold.firmament
@@ -0,0 +1,10 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: expect_manifold
diff --git a/testdata/firmament/fixtures/m1c-valid-expect-selectable.firmament b/testdata/firmament/fixtures/m1c-valid-expect-selectable.firmament
new file mode 100644
index 00000000..3494f0f9
--- /dev/null
+++ b/testdata/firmament/fixtures/m1c-valid-expect-selectable.firmament
@@ -0,0 +1,12 @@
+firmament:
+ version: 1
+
+model:
+ name: demo
+ units: mm
+
+ops[1]:
+ -
+ op: expect_selectable
+ target: hole
+ count: 4
diff --git a/testdata/firmament/manifests/m0c.corpus.json b/testdata/firmament/manifests/m0c.corpus.json
index 101368eb..e96291a2 100644
--- a/testdata/firmament/manifests/m0c.corpus.json
+++ b/testdata/firmament/manifests/m0c.corpus.json
@@ -368,6 +368,90 @@
"kernelCode": "ValidationFailed",
"firmamentCode": "FIRM-STRUCT-0013"
}
+ },
+ {
+ "id": "m1c-valid-expect-exists",
+ "name": "Valid expect_exists validation required fields",
+ "fixturePath": "testdata/firmament/fixtures/m1c-valid-expect-exists.firmament",
+ "expectedOutcome": "success"
+ },
+ {
+ "id": "m1c-valid-expect-selectable",
+ "name": "Valid expect_selectable validation required fields",
+ "fixturePath": "testdata/firmament/fixtures/m1c-valid-expect-selectable.firmament",
+ "expectedOutcome": "success"
+ },
+ {
+ "id": "m1c-valid-expect-manifold",
+ "name": "Valid expect_manifold validation required fields",
+ "fixturePath": "testdata/firmament/fixtures/m1c-valid-expect-manifold.firmament",
+ "expectedOutcome": "success"
+ },
+ {
+ "id": "m1c-invalid-expect-exists-missing-target",
+ "name": "Invalid expect_exists missing target",
+ "fixturePath": "testdata/firmament/fixtures/m1c-invalid-expect-exists-missing-target.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-STRUCT-0014"
+ }
+ },
+ {
+ "id": "m1c-invalid-expect-selectable-missing-target",
+ "name": "Invalid expect_selectable missing target",
+ "fixturePath": "testdata/firmament/fixtures/m1c-invalid-expect-selectable-missing-target.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-STRUCT-0014"
+ }
+ },
+ {
+ "id": "m1c-invalid-expect-selectable-missing-count",
+ "name": "Invalid expect_selectable missing count",
+ "fixturePath": "testdata/firmament/fixtures/m1c-invalid-expect-selectable-missing-count.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-STRUCT-0014"
+ }
+ },
+ {
+ "id": "m1c-invalid-expect-selectable-non-numeric-count",
+ "name": "Invalid expect_selectable non-numeric count",
+ "fixturePath": "testdata/firmament/fixtures/m1c-invalid-expect-selectable-non-numeric-count.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-STRUCT-0015"
+ }
+ },
+ {
+ "id": "m1c-invalid-expect-selectable-non-integer-count",
+ "name": "Invalid expect_selectable non-integer count",
+ "fixturePath": "testdata/firmament/fixtures/m1c-invalid-expect-selectable-non-integer-count.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-STRUCT-0016"
+ }
+ },
+ {
+ "id": "m1c-invalid-expect-selectable-non-positive-count",
+ "name": "Invalid expect_selectable non-positive count",
+ "fixturePath": "testdata/firmament/fixtures/m1c-invalid-expect-selectable-non-positive-count.firmament",
+ "expectedOutcome": "failure",
+ "expectedDiagnostic": {
+ "source": "firmament",
+ "kernelCode": "ValidationFailed",
+ "firmamentCode": "FIRM-STRUCT-0016"
+ }
}
]
}