public static void RunTests_ZeroOneImaginaryOne()
        {
            double real      = Support.GetRandomDoubleValue(false);
            double imaginary = Support.GetRandomPhaseValue(false);

            // Test with Zero
            VerifyBinaryMultiplyResult(0.0, 0.0, real, imaginary); // Verify 0*x=0
            VerifyBinaryMultiplyResult(real, imaginary, 0.0, 0.0); // Verify x*0=0

            // Test with One
            VerifyBinaryMultiplyResult(1.0, 0.0, real, imaginary); // Verify 1*x=x
            VerifyBinaryMultiplyResult(real, imaginary, 1.0, 0.0); // Verify x*1=x

            // Test with ImaginaryOne
            VerifyBinaryMultiplyResult(0.0, 1.0, real, imaginary); // Verify -i*x
            VerifyBinaryMultiplyResult(real, imaginary, 0.0, 1.0); // Verify x*-i
        }
Exemplo n.º 2
0
        public static void RunTests_RandomValidValues()
        {
            // local Random real and imaginary parts
            double magnitudeRandom;
            double phaseRandom;

            // Complex numbers (postive magnitude, positive phase)
            for (int i = 0; i < 3; i++)
            {
                magnitudeRandom = Support.GetRandomDoubleValue(false);
                phaseRandom     = Support.GetRandomPhaseValue(false);
                VerifyFromPolarCoordinates(magnitudeRandom, phaseRandom);
            }

            // Complex numbers (negative magnitude, positive phase)
            for (int i = 0; i < 3; i++)
            {
                magnitudeRandom = Support.GetRandomDoubleValue(true);
                phaseRandom     = Support.GetRandomPhaseValue(false);
                VerifyFromPolarCoordinates(magnitudeRandom, phaseRandom);
            }

            // Complex numbers (negative magnitude, negative phase)
            for (int i = 0; i < 3; i++)
            {
                magnitudeRandom = Support.GetRandomDoubleValue(true);
                phaseRandom     = Support.GetRandomPhaseValue(true);
                VerifyFromPolarCoordinates(magnitudeRandom, phaseRandom);
            }

            // Complex numbers (positive magnitude, negative phase)
            for (int i = 0; i < 3; i++)
            {
                magnitudeRandom = Support.GetRandomDoubleValue(false);
                phaseRandom     = Support.GetRandomPhaseValue(true);
                VerifyFromPolarCoordinates(magnitudeRandom, phaseRandom);
            }
        }