/// <summary> /// This method will process the testing of application components when the user clicks the "Preflight" button. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void TestThruster_Click(object sender, EventArgs e) { textBox2.Text = "Running pre-flight checks...\r\n"; textBox2.Refresh(); textBox2.Text += "Trajectory Model: "; textBox2.Text += ThrottleCalculator.SelfTest() == true ? "Success\r\n" : "Failure\r\n"; textBox2.Text += "Thruster: "; textBox2.Text += MainThruster.SelfTest() == true ? "Success\r\n" : "Failure\r\n"; textBox2.Text += "RollThruster: "; textBox2.Text += RollThruster.SelfTest() == true ? "Success\r\n" : "Failure\r\n"; textBox2.Text += "AxialThruster: "; textBox2.Text += AxialThruster.SelfTest() == true ? "Success\r\n" : "Failure\r\n"; textBox2.Text += "Guidance Control: "; textBox2.Text += GuidanceSystem.SelfTest() == true ? "Success\r\n" : "Failure\r\n"; textBox2.Text += "Pre-flight checks completed."; }
public bool SelfTest() { /* Test cases to test against: * RollCorrection * - 0 roll delta = 0 total corrective duration, and no firing * - 1 roll delta = turn on engines, apply .2 seconds of corrective wait * - -1 roll deltr = turn on engines to -1, apply .2 seconds of corrective wait * - 10 roll delta = turn engines on to 1, apply 2 seconds of corrective wait * - -10 roll delta = turn engines on to -1, apply 2 seconds of corrective wait * * correctSpin * - 0 roll = 0 total corrective duration, and no firing * - 1 rpm = turn on engines, apply .1 seconds of corrective wait * - -1 rpm = turn on engines to -1, apply .1 seconds of corrective wait * - 10 rpm = turn engines on to 1, apply 1 seconds of corrective wait * - -10 rpm = turn engines on to -1, apply 1 seconds of corrective wait */ bool returnVal = true; RollThruster testThruster = new RollThruster(); if (returnVal == true) { returnVal = (testThruster.applyRollCorrection(0) == 0); } if (returnVal == true) { returnVal = (testThruster.applyRollCorrection(1) == .2); } if (returnVal == true) { returnVal = (testThruster.applyRollCorrection(-1) == .2); } if (returnVal == true) { returnVal = (testThruster.applyRollCorrection(10) == 2); } if (returnVal == true) { returnVal = (testThruster.applyRollCorrection(-10) == 2); } if (returnVal == true) { returnVal = (testThruster.correctCurrentSpin(0) == 0); } if (returnVal == true) { returnVal = (testThruster.correctCurrentSpin(1) == .1); } if (returnVal == true) { returnVal = (testThruster.correctCurrentSpin(-1) == .1); } if (returnVal == true) { returnVal = (testThruster.correctCurrentSpin(10) == 1); } if (returnVal == true) { returnVal = (testThruster.correctCurrentSpin(-10) == 1); } return(returnVal); }