Esempio n. 1
0
        public void WhenMaxtrixClonedThenValuesIdentical()
        {
            int           size   = 5;
            WeightsMatrix matrix = new WeightsMatrix(size);

            for (int i = 0; i < size; i++)
            {
                for (int j = 0; j < size; j++)
                {
                    int weight = CalculateWeight(i, j);
                    matrix.SetWeight(i, j, weight);
                }
            }

            WeightsMatrix clonedMatrix = matrix.Clone() as WeightsMatrix;

            Assert.IsNotNull(clonedMatrix);

            for (int i = 0; i < size; i++)
            {
                for (int j = 0; j < size; j++)
                {
                    int weight = CalculateWeight(i, j);
                    Assert.AreEqual(weight, matrix.GetWeight(i, j));
                }
            }
        }
Esempio n. 2
0
        public void WhenConstructedThenAllWeightsAreZero()
        {
            int           size   = 5;
            WeightsMatrix matrix = new WeightsMatrix(size);

            for (int i = 0; i < size; i++)
            {
                for (int j = 0; j < size; j++)
                {
                    Assert.AreEqual(0, matrix.GetWeight(i, j));
                }
            }
        }
Esempio n. 3
0
        public void WhenWeightIsSetThenRetrievedWeightMatchesSetValue()
        {
            int           size   = 5;
            WeightsMatrix matrix = new WeightsMatrix(size);

            for (int i = 0; i < size; i++)
            {
                for (int j = 0; j < size; j++)
                {
                    int weight = CalculateWeight(i, j);
                    matrix.SetWeight(i, j, weight);
                    Assert.AreEqual(weight, matrix.GetWeight(i, j));
                }
            }
        }