Esempio n. 1
0
        public void Value_ReturnsKnownResults_ForKnownPhases_BeforeAndAfterSetDutyCycle()
        {
            double initialDutyCycle = 0.25;

            double[]   initialPhases         = { 0.0, 0.2, initialDutyCycle *Constants._2PI, 3.0, Constants._2PI };
            double[]   initialexpectedValues = { 1.0, 1.0, 0.0, 0.0, 1.0 };
            SquareWave sw = new SquareWave(initialDutyCycle);

            TestMethods.TestKnownInputsAgainstKnownResults(sw, initialPhases, initialexpectedValues);

            double finalDutyCycle = 0.6;

            double[] finalPhases         = { 0.0, 0.2, initialDutyCycle *Constants._2PI, 3.0, 6.0, Constants._2PI };
            double[] finalExpectedValues = { 1.0, 1.0, 1.0, 1.0, 0.0, 1.0 };
            sw.DutyCycle = finalDutyCycle;
            TestMethods.TestKnownInputsAgainstKnownResults(sw, finalPhases, finalExpectedValues);
        }
        public void Value_ReturnsKnownResults_ForKnownPhases_BeforeAndAfterSetDutyCycle()
        {
            double initialDutyCycle = 0.25;

            double[]     initialPhases         = { 0.0, initialDutyCycle / 2.0 * Math.PI, initialDutyCycle *Math.PI, 3.0 / 2.0 * initialDutyCycle * Math.PI, Constants._2PI };
            double[]     initialexpectedValues = { 0.0, 0.5, 1.0, 0.5, 0.0 };
            TriangleWave tw = new TriangleWave(initialDutyCycle);

            TestMethods.TestKnownInputsAgainstKnownResults(tw, initialPhases, initialexpectedValues);

            double finalDutyCycle = 0.6;

            double[] finalPhases         = { 0.0, finalDutyCycle / 2.0 * Math.PI, finalDutyCycle *Math.PI, 3.0 / 2.0 * finalDutyCycle * Math.PI, Constants._2PI };
            double[] finalExpectedValues = { 0.0, 0.5, 1.0, 0.5, 0.0 };
            tw.DutyCycle = finalDutyCycle;
            TestMethods.TestKnownInputsAgainstKnownResults(tw, finalPhases, finalExpectedValues);
        }