CadParamPluging/Tests/RingRawFreeForgeCenterPunchFilletTests.cs

48 lines
1.9 KiB
C#

using System;
using System.IO;
public static class RingRawFreeForgeCenterPunchFilletTests
{
public static int Main()
{
try
{
CenterPunchInnerLowerFilletsUseUnspecifiedRadius();
Console.WriteLine("Ring raw free-forge center-punch fillet tests passed.");
return 0;
}
catch (Exception ex)
{
Console.Error.WriteLine(ex.Message);
return 1;
}
}
private static void CenterPunchInnerLowerFilletsUseUnspecifiedRadius()
{
var sourcePath = Path.Combine("Cad", "Drawers", "RingRawFreeForgeCenterPunchDrawer.cs");
var source = File.ReadAllText(sourcePath);
if (!source.Contains("var lowerInnerFilletR = outerFilletR;"))
{
throw new InvalidOperationException(sourcePath + ": lower inner hole fillets must use UnspecifiedFilletRadiusMax.");
}
if (!source.Contains("rBottomLeft: outerFilletR, rBottomRight: lowerInnerFilletR, rTopRight: innerFilletR, rTopLeft: outerFilletR"))
{
throw new InvalidOperationException(sourcePath + ": left section must keep the upper inner fillet as InnerRadiusMax and use UnspecifiedFilletRadiusMax only for the lower inner fillet.");
}
if (!source.Contains("rBottomLeft: lowerInnerFilletR, rBottomRight: outerFilletR, rTopRight: outerFilletR, rTopLeft: innerFilletR"))
{
throw new InvalidOperationException(sourcePath + ": right section must keep the upper inner fillet as InnerRadiusMax and use UnspecifiedFilletRadiusMax only for the lower inner fillet.");
}
if (!source.Contains("double lineStartBottom = xInnerLeftVal - lowerInnerFilletR;") ||
!source.Contains("double lineEndBottom = xInnerRightVal + lowerInnerFilletR;"))
{
throw new InvalidOperationException(sourcePath + ": lower hole connecting line must align with the new lower inner fillet radius.");
}
}
}