public void PinBoardTest() { #region Inputs double BoardWidth = 4; double BoardHeight = 1; double CutDepth = 2; double EndMillDiameter = (double)1 / 8; double Clearance = (double)1 / 64; double EndPinWidth = 0.5; int NumInteriorPins = 1; #endregion #region Assignment Breakpoints testPoints = new Breakpoints(BoardWidth, Clearance, EndPinWidth, NumInteriorPins); double[] testPinPoints = testPoints.generatePinBoard(); Board testBoard = new Board(BoardHeight, BoardWidth, EndMillDiameter, CutDepth, Clearance); CutArea[] testAreas = testBoard.generatePinBoard(EndPinWidth, NumInteriorPins); int x = 0; #endregion #region Testing for (int i = 1; i < testPinPoints.Length - 1;) { Assert.AreEqual(testPinPoints[i++], testAreas[x].xStart); Assert.AreEqual(testPinPoints[i++], testAreas[x].xStop); Assert.AreEqual((0 - (0.5 * EndMillDiameter)), testAreas[x].yStart); Assert.AreEqual((BoardWidth + (0.5 * EndMillDiameter)), testAreas[x].yStop); Assert.AreEqual(CutDepth, testAreas[x++].CutDepth); } #endregion }
private CutArea[] generatePinBoard(Breakpoints breakpoints) { List<CutArea> cutAreas = new List<CutArea>(); CutArea temp; double xStart; double xStop; double yStart = 0 - (0.5 * _endMillDiameter); double yStop = _boardWidth + (0.5 * _endMillDiameter); double[] pinBoardBreaks = breakpoints.generatePinBoard(); for (int i = 1; i < pinBoardBreaks.Length - 1;) { xStart = pinBoardBreaks[i++]; xStop = pinBoardBreaks[i++]; temp = new CutArea(xStart, xStop, yStart, yStop, _cutDepth); cutAreas.Add(temp); } return cutAreas.ToArray(); }
public Form1() { InitializeComponent(); double BoardWidth = 7; double BoardHeight = 2; double CutDepth = 2; double EndMillDiameter = (double)1 / 8; double Clearance = ((double)1 / 32); double EndPinWidth = 1; int NumInteriorPins = 5; Breakpoints breakPointsTest = new Breakpoints(BoardWidth, Clearance, EndPinWidth, NumInteriorPins); Console.WriteLine(); Console.WriteLine("Ideal Breakpoints:"); Console.WriteLine("[" + string.Join(", ", breakPointsTest.IdealBreakpoints) + "]"); Console.WriteLine("Pin Board Break Points:"); Console.WriteLine("[" + string.Join(", ", breakPointsTest.generatePinBoard()) + "]"); Console.WriteLine("Socket Board Break Points:"); Console.WriteLine("[" + string.Join(", ", breakPointsTest.generateSocketBoard()) + "]"); Board boardTest = new Board(BoardHeight, BoardWidth, EndMillDiameter, CutDepth, Clearance); CutArea[] pinBoardTest = boardTest.generatePinBoard(EndPinWidth, NumInteriorPins); CutArea[] socketBoardTest = boardTest.generateSocketBoard(EndPinWidth, NumInteriorPins); Console.WriteLine(); Console.WriteLine("Pinboard areas to be cut:"); foreach (CutArea cutArea in pinBoardTest) { Console.WriteLine(cutArea.ToString()); } Console.WriteLine("Socketboard areas to be cut:"); foreach (CutArea cutArea in socketBoardTest) { Console.WriteLine(cutArea.ToString()); } }
public void BreakpointTestClearance() { #region Inputs double BoardWidth = 7; double Clearance = ((double)1 / 64); double EndPinWidth = 0.5; int NumInteriorPins = 1; #endregion #region Assignment testPoints = new Breakpoints(BoardWidth, Clearance, EndPinWidth, NumInteriorPins); double[] pinBoard = testPoints.generatePinBoard(); double[] socketBoard = testPoints.generateSocketBoard(); int numItems = testPoints.Count; double difference = 0; #endregion #region Testing Assert.AreEqual(pinBoard[0], socketBoard[0]); for(int i = 2; i < numItems - 2; i++) { difference = Math.Abs(pinBoard[i] - socketBoard[i]); Assert.AreEqual(Clearance, difference); } Assert.AreEqual(pinBoard[numItems - 1], socketBoard[numItems - 1]); #endregion }