Esempio n. 1
0
        public async Task Should_find_parallel_indexOf_greaterThan(int levelOfParallelism)
        {
            var source = new int[_width * _height];

            for (var y = 0; y < _height; y++)
            {
                source[y * _width + 1] = 1;
                source[y * _width + 9] = 1;
            }
            var result = new int[source.Length * 2];
            var count  = await _indexOf.ParallelIndexOfGreaterThan(_width, _height, source, result, comparand : 0, levelOfParallelism : levelOfParallelism);

            count.Should().Be(2 * _height);
            var results = new HashSet <(int, int)>();

            for (var i = 0; i < count * 2; i += 2)
            {
                results.Add((result[i], result[i + 1]));
            }
            for (var y = 0; y < _height; y++)
            {
                results.Should().Contain((1, y));
                results.Should().Contain((9, y));
            }
        }
Esempio n. 2
0
 public async Task IndexOfGreaterThan()
 {
     _result = await _indexOf.ParallelIndexOfGreaterThan(_width, _height, _source, _indexes, 99 - Saturation, LevelOfParallelism);
 }