예제 #1
0
        public void Test_PassCountStatisticsAggregator_AggregateWith_DifferingPassCountTargets()
        {
            var aggregator = new PassCountStatisticsAggregator
            {
                LastPassCountTargetRange = new PassCountRangeRecord(2, 4),
                SummaryCellsScanned      = 1
            };

            var otheraggregator = new PassCountStatisticsAggregator
            {
                LastPassCountTargetRange = new PassCountRangeRecord(3, 5),
                SummaryCellsScanned      = 1
            };

            aggregator.IsTargetValueConstant.Should().BeTrue();
            otheraggregator.IsTargetValueConstant.Should().BeTrue();

            aggregator.AggregateWith(otheraggregator);
            aggregator.IsTargetValueConstant.Should().BeFalse();
        }
예제 #2
0
        public void Test_PassCountStatisticsAggregator_ProcessResult_WithAggregation_Details()
        {
            var aggregator = new PassCountStatisticsAggregator();

            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.PassCount) as ClientPassCountLeafSubGrid;

            clientGrid.FillWithTestPattern();

            var dLength = clientGrid.Cells.Length;
            var length  = (short)Math.Sqrt(dLength);

            aggregator.CellSize          = TestConsts.CELL_SIZE;
            aggregator.DetailsDataValues = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
            aggregator.Counts            = new long[aggregator.DetailsDataValues.Length];

            IClientLeafSubGrid[][] subGrids = new[] { new[] { clientGrid } };

            aggregator.ProcessSubGridResult(subGrids);

            // Other aggregator...
            var otherAggregator = new PassCountStatisticsAggregator();

            otherAggregator.CellSize          = TestConsts.CELL_SIZE;
            otherAggregator.DetailsDataValues = new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
            otherAggregator.Counts            = new long[aggregator.DetailsDataValues.Length];

            otherAggregator.ProcessSubGridResult(subGrids);

            aggregator.AggregateWith(otherAggregator);

            Assert.True(aggregator.Counts.Length == aggregator.DetailsDataValues.Length, "Invalid value for DetailsDataValues.");
            for (int i = 0; i < aggregator.Counts.Length; i++)
            {
                Assert.True(aggregator.Counts[i] == otherAggregator.Counts[i] * 2, $"Invalid aggregated value for Counts[{i}].");
            }
        }
예제 #3
0
        public void Test_PassCountStatisticsAggregator_ProcessResult_WithAggregation_Summary()
        {
            var aggregator = new PassCountStatisticsAggregator();

            var clientGrid = ClientLeafSubGridFactoryFactory.CreateClientSubGridFactory().GetSubGrid(GridDataType.PassCount) as ClientPassCountLeafSubGrid;

            clientGrid.FillWithTestPattern();

            var dLength = clientGrid.Cells.Length;
            var length  = (short)Math.Sqrt(dLength);

            aggregator.CellSize = TestConsts.CELL_SIZE;
            aggregator.OverrideTargetPassCount        = true;
            aggregator.OverridingTargetPassCountRange = new PassCountRangeRecord((ushort)length, (ushort)length);

            IClientLeafSubGrid[][] subGrids = new[] { new[] { clientGrid } };

            aggregator.ProcessSubGridResult(subGrids);

            // Other aggregator...
            var otherAggregator = new PassCountStatisticsAggregator();

            otherAggregator.CellSize = TestConsts.CELL_SIZE;
            otherAggregator.OverrideTargetPassCount        = true;
            otherAggregator.OverridingTargetPassCountRange = new PassCountRangeRecord((ushort)length, (ushort)length);

            otherAggregator.ProcessSubGridResult(subGrids);

            aggregator.AggregateWith(otherAggregator);

            Assert.True(aggregator.SummaryCellsScanned == dLength * 2, "Invalid value for SummaryCellsScanned.");
            Assert.True(Math.Abs(aggregator.SummaryProcessedArea - 2 * dLength * Math.Pow(aggregator.CellSize, 2)) < Consts.TOLERANCE_DIMENSION, "Invalid value for SummaryProcessedArea.");
            Assert.True(aggregator.CellsScannedAtTarget == length * 2, "Invalid value for CellsScannedAtTarget.");
            Assert.True(aggregator.CellsScannedOverTarget == 0, "Invalid value for CellsScannedOverTarget.");
            Assert.True(aggregator.CellsScannedUnderTarget == (dLength - length) * 2, "Invalid value for CellsScannedUnderTarget.");
        }