コード例 #1
0
        public void Subtract_SingleDouble_AllSubtractedByThatAmount()
        {
            var dataColumn = CreateDataColumn();
            var expected   = new List <double> {
                0, 1, 2
            };

            var actual = dataColumn.Subtract(1);

            Assert.True(FloatingCompare.FloatingEnumerablesAreVeryClose(actual, expected));
        }
コード例 #2
0
        public void Times_SingleDouble_AllMultipliedByThatAmount()
        {
            var dataColumn = CreateDataColumn();
            var expected   = new List <double> {
                2, 4, 6
            };

            var actual = dataColumn.Times(2);

            Assert.True(FloatingCompare.FloatingEnumerablesAreVeryClose(actual, expected));
        }
コード例 #3
0
        public void Add_SingleDouble_AllAddUpThatAmount()
        {
            var dataColumn = CreateDataColumn();
            var expected   = new List <double> {
                2, 3, 4
            };

            var actual = dataColumn.Add(1);

            Assert.True(FloatingCompare.FloatingEnumerablesAreVeryClose(actual, expected));
        }
コード例 #4
0
        public void DividedBy_SingleDouble_AllDividedByThatAmount()
        {
            var dataColumn = CreateDataColumn();
            var expected   = new List <double> {
                1 / 2.0, 2 / 2.0, 3 / 2.0
            };


            var actual = dataColumn.DividedBy(2);

            Assert.True(FloatingCompare.FloatingEnumerablesAreVeryClose(actual, expected));
        }
コード例 #5
0
        public void CalculateWeight_WhenTwoRequiredColumnsValid_ReturnProperWeight()
        {
            var rectificationEntity = CreateRectificationEntity("Angle");

            rectificationEntity.PixelColumn         = MeasuredData.Angle;
            rectificationEntity.MillimeterColumnOMM = OMMData.Angle;
            var expected = Weights.Angle;

            var actual = rectificationEntity.CalculateWeight();

            Assert.True(FloatingCompare.FloatingNumberAreClose(actual, expected));
        }
コード例 #6
0
        public void Subtract_ACollectionOfDouble_CorrespondinglySubtracted()
        {
            var dataColumn = CreateDataColumn();
            var expected   = new List <double> {
                0, 0, 0
            };

            var actual = dataColumn.Subtract(new List <double> {
                1, 2, 3
            }).ToList();

            Assert.True(FloatingCompare.FloatingEnumerablesAreVeryClose(actual, expected));
        }
コード例 #7
0
        public void Times_ACollectionOfDouble_CorrespondinglyMultiplied()
        {
            var dataColumn = CreateDataColumn();
            var expected   = new List <double> {
                1, 4, 9
            };

            var actual = dataColumn.Times(new List <double> {
                1, 2, 3
            }).ToList();

            Assert.True(FloatingCompare.FloatingEnumerablesAreVeryClose(actual, expected));
        }
コード例 #8
0
        public void Calculate_UsingSingleCalculationEntity_CalculateProperWeight()
        {
            var unit = CreateWeightCalculationUnit();

            unit.AddWeightCalculationEntity(new RectificationEntity("Angle")
            {
                PixelColumn = MeasuredData.Angle, MillimeterColumnOMM = OMMData.Angle
            });
            var weightExpected = Weights.Angle;

            unit.Calculate();
            var weightActual = unit.Weight;

            Assert.True(FloatingCompare.FloatingNumberAreClose(weightActual, weightExpected));
        }
コード例 #9
0
        public void EstimateBiasedMillimeterDistances_WhenTwoRequiredColumnsValid_CalcBiasProperly()
        {
            var rectificationEntity = CreateRectificationEntity("X1");

            rectificationEntity.PixelColumn         = MeasuredData.X1_Pixel;
            rectificationEntity.MillimeterColumnOMM = OMMData.X1;
            rectificationEntity.Weight = Weights.X;
            var expectedBias     = Biases.X1;
            var expectedEstimate = Estimates.X1;

            rectificationEntity.EstimateBiasedMillimeterDistances();
            var actualBias     = rectificationEntity.Bias;
            var actualEstimate = rectificationEntity.MillimeterColumnEstimate;

            Assert.True(FloatingCompare.FloatingNumberAreClose(actualBias, expectedBias));
            Assert.True(FloatingCompare.FloatingEnumerablesAreVeryClose(actualEstimate, expectedEstimate));
        }
コード例 #10
0
        public void Calculate_UsingMultipleCalculationEntities_CalculateProperWeight()
        {
            var unit = CreateWeightCalculationUnit();

            unit.AddWeightCalculationEntity(new RectificationEntity("X1")
            {
                PixelColumn = MeasuredData.X1_Pixel, MillimeterColumnOMM = OMMData.X1
            });
            unit.AddWeightCalculationEntity(new RectificationEntity("X2")
            {
                PixelColumn = MeasuredData.X2_Pixel, MillimeterColumnOMM = OMMData.X2
            });
            var weightExpected = Weights.X;

            unit.Calculate();
            var weightActual = unit.Weight;

            Assert.True(FloatingCompare.FloatingNumberAreClose(weightActual, weightExpected));
        }