//glennj 1/30/2014 /// <summary> /// Some frequencies will not be exact as set. They will be expected to be within a range though. /// </summary> /// <param name="awg"></param> /// <param name="clockNumber"></param> /// <param name="expectedValue"></param> /// <param name="percent"></param> public void ClockOutputFrequencyShouldBe(IAWG awg, string clockNumber, string expectedValue, string percent = null) { string possibleErrorString = "Checking the output clock frequency for clock " + clockNumber; if (percent == null) { Assert.AreEqual(float.Parse(expectedValue), float.Parse(awg.ClockOutputFrequency(clockNumber)), possibleErrorString); } else { float value = float.Parse(expectedValue); //Parse the string to begin calculations float percentage = float.Parse(percent); double min = value - ((value * (percentage / 100.0))); double max = value + ((value * (percentage / 100.0))); double actual = float.Parse(awg.ClockOutputFrequency(clockNumber)); Assert.IsTrue((actual >= min) && (actual <= max), "Output clock frequency of " + actual + " was not between " + min + " and " + max); } }