示例#1
0
        public void ClockSRateWithUnitsShouldBe(IAWG awg, string clockNumber, string expectedValue, string percent)
        {
            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 mean = float.Parse(awg.ClockSampleRate(clockNumber));

            Assert.IsTrue((mean >= min) && (mean <= max), "Sample rate " + mean + " was not between " + min + " and " + max);
        }
示例#2
0
        public void ClockSRateWithPercentOnlyShouldBe(IAWG awg, string clockNumber, string expectedValue, string percent)
        {
            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 mean = float.Parse(awg.ClockSampleRate(clockNumber));

            // This may or may not stay in the final code.
            // The goal is to get a little more detail to any failure, (aka not between the min and max)
            // like if there was more time, would we get the correct answer.
            // This would mean that the clock rate really wasn't ready when it said it was
            // which is why were getting the current value to check.
            // If it is really stuck, then there are other problems.
            // And for the reader, this is not normally what would happen but this is where
            // it appears to be breaking so in goes the check until further notice.
            //
            // First pass at the code will be to pause for 1 second, and then get the clock rate again.
            if (!((mean >= min) && (mean <= max)))
            {
                //bool didItFailTheInitialTest = true;
                const int additionalPause = 5;
                _utilitiesGroup.WaitNSeconds(additionalPause);
                GetClockSRate(awg, "1");            // For now, only clock 1
                double meanAgain = float.Parse(awg.ClockSampleRate(clockNumber));

                if (!((meanAgain >= min) && (meanAgain <= max)))
                {
                    string possibleError = "After pausing another " + additionalPause.ToString(CultureInfo.InvariantCulture) + " seconds, the sample rate " + meanAgain + " was not between " + min + " and " + max;
                    Assert.IsTrue((meanAgain >= min) && (meanAgain <= max), possibleError);
                }
                else
                {
                    string possibleError = "After pausing another " + additionalPause.ToString(CultureInfo.InvariantCulture) + " seconds, the sample rate was correct.  First test failed when it said it was done.";
                    Assert.IsTrue((mean >= min) && (mean <= max), possibleError);
                }
            }
        }
示例#3
0
        public void ClockSRateShouldBe(IAWG awg, string clockNumber, string expectedValue)
        {
            string possibleErrorString = "Checking the clock sample rate for clock " + clockNumber;

            Assert.AreEqual(expectedValue, awg.ClockSampleRate(clockNumber), possibleErrorString);
        }