Пример #1
0
        public void Residuals_ReturnsCorrect()
        {
            //	prereq
            Average_ReturnsAverageOfArray();

            //  arrange
            float[] data = new float[] { 2, 4, 6 };
            float   mean = data.Average();

            float[] actual = new float[data.Length];
            for (int i = 0; i < data.Length; i++)
            {
                actual[i] = data[i] - mean;
            }

            //  act
            float[] resi = PMath.Residuals(data);

            //  assert
            for (int i = 0; i < data.Length; i++)
            {
                Assert.AreEqual(actual[i], resi[i], i + ":" + TestHelper.ShowVariables(actual[i], resi[i]));
            }
        }