Пример #1
0
 public void Range_MinGreaterThanMax()
 {
     // Act & Assert
     Assert.Throws(typeof(ArgumentException),
                   // ReSharper disable once ObjectCreationAsStatement
                   () => DoubleRange.Range(20, 10));
 }
Пример #2
0
        public void Range_MinLowerThanMax()
        {
            // Act
            var range = DoubleRange.Range(10, 20);

            // Assert
            AssertChunks(range, 10, 20);
        }
Пример #3
0
        public void Range_MinEqualToMax()
        {
            // Act
            var range = DoubleRange.Range(10, 10);

            // Assert
            AssertChunks(range, 10, 10);
        }
Пример #4
0
        public void AddChunk_ImmediatelyBeforeMin1()
        {
            var range = DoubleRange.Range(10, 20);

            // Assume
            AssertChunks(range, 10, 20);

            // Act
            range.Range(_Before10, _Before10);

            // Assert
            AssertChunks(range, _Before10, 20);
        }
Пример #5
0
        public void AddChunk_Error()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            // Assume
            AssertChunks(range, 10, 20);

            // Act & Assert
            Assert.Throws(typeof(ArgumentException),
                          // ReSharper disable once ObjectCreationAsStatement
                          () => range.Range(20, 10));
        }
Пример #6
0
        public void AddChunk_AfterMaxInfinity()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            // Assume
            AssertChunks(range, 10, 20);

            // Act
            range.Range(30, double.MaxValue);

            // Assert
            AssertChunks(range, 10, 20, 30, double.MaxValue);
        }
Пример #7
0
        public void AddChunk_AfterMax()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            // Assume
            AssertChunks(range, 10, 20);

            // Act
            range.Range(30, 40);

            // Assert
            AssertChunks(range, 10, 20, 30, 40);
        }
Пример #8
0
        public void AddChunk_MaxImmediatelyAfterMax()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            // Assume
            AssertChunks(range, 10, 20);

            // Act
            range.Range(15, _After20);

            // Assert
            AssertChunks(range, 10, _After20);
        }
Пример #9
0
        public void AddChunk_ContainingMax()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            // Assume
            AssertChunks(range, 10, 20);

            // Act
            range.Range(12, 25);

            // Assert
            AssertChunks(range, 10, 25);
        }
Пример #10
0
        public void AddChunk_BetweenMinMax()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            // Assume
            AssertChunks(range, 10, 20);

            // Act
            range.Range(12, 14);

            // Assert
            AssertChunks(range, 10, 20);
        }
Пример #11
0
        public void AddChunk_ContainingMin()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            // Assume
            AssertChunks(range, 10, 20);

            // Act
            range.Range(5, 14);

            // Assert
            AssertChunks(range, 5, 20);
        }
Пример #12
0
        public void AddChunk_MinImmediatelyBeforeMin()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            // Assume
            AssertChunks(range, 10, 20);

            // Act
            range.Range(_Before10, 15);

            // Assert
            AssertChunks(range, _Before10, 20);
        }
Пример #13
0
        public void AddChunk_InfinityBeforeMin()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            // Assume
            AssertChunks(range, 10, 20);

            // Act
            range.Range(double.MinValue, 8);

            // Assert
            AssertChunks(range, double.MinValue, 8, 10, 20);
        }
Пример #14
0
        public void AddChunk_BeforeMin()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            // Assume
            AssertChunks(range, 10, 20);

            // Act
            range.Range(5, 8);

            // Assert
            AssertChunks(range, 5, 8, 10, 20);
        }
Пример #15
0
        public void AddChunk2_ContainingMinMax1_Infinity()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            range.Range(30, 40);

            // Assume
            AssertChunks(range, 10, 20, 30, 40);

            // Act
            range.Range(5, double.MaxValue);

            // Assert
            AssertChunks(range, 5, double.MaxValue);
        }
Пример #16
0
        public void AddChunk2_ImmediatelyAfterMax2_Infinity()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            range.Range(30, 40);

            // Assume
            AssertChunks(range, 10, 20, 30, 40);

            // Act
            range.Range(_After40, double.MaxValue);

            // Assert
            AssertChunks(range, 10, 20, 30, double.MaxValue);
        }
Пример #17
0
        public void AddChunkThatCompleteBoth()
        {
            // Arrange
            var range = DoubleRange.Range(1, double.MaxValue);

            range.Range(double.MinValue, -1);

            // Assume
            AssertChunks(range, double.MinValue, -1, 1, double.MaxValue);

            // Act
            range.Range(BitConverterHelper.Next((double)-1), BitConverterHelper.Previous((double)1));

            // Assert
            AssertChunks(range, double.MinValue, double.MaxValue);
        }
Пример #18
0
        public void AddChunk2_BetweenMinMax2_AfterMax2()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            range.Range(30, 40);

            // Assume
            AssertChunks(range, 10, 20, 30, 40);

            // Act
            range.Range(34, 46);

            // Assert
            AssertChunks(range, 10, 20, 30, 46);
        }
Пример #19
0
        public void AddChunk2_BetweenMinMax2_Infinity()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            range.Range(30, 40);

            // Assume
            AssertChunks(range, 10, 20, 30, 40);

            // Act
            range.Range(34, double.MaxValue);

            // Assert
            AssertChunks(range, 10, 20, 30, double.MaxValue);
        }
Пример #20
0
        public void AddChunk2_ImmediatelyBeforeMin1()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            range.Range(30, 40);

            // Assume
            AssertChunks(range, 10, 20, 30, 40);

            // Act
            range.Range(5, _Before10);

            // Assert
            AssertChunks(range, 5, 20, 30, 40);
        }
Пример #21
0
        public void AddChunk2_AfterMax1_ImmediatelyBeforeMin2()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            range.Range(30, 40);

            // Assume
            AssertChunks(range, 10, 20, 30, 40);

            // Act
            range.Range(23, _Before30);

            // Assert
            AssertChunks(range, 10, 20, 23, 40);
        }
Пример #22
0
        public void AddChunk2_ContainingMinMax1_ImmediatelyBeforeMin2()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            range.Range(30, 40);

            // Assume
            AssertChunks(range, 10, 20, 30, 40);

            // Act
            range.Range(5, _Before30);

            // Assert
            AssertChunks(range, 5, 40);
        }
Пример #23
0
        public void AddChunk2_ImmediatelyAfterMax1_AfterMax2()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            range.Range(30, 40);

            // Assume
            AssertChunks(range, 10, 20, 30, 40);

            // Act
            range.Range(_After20, 45);

            // Assert
            AssertChunks(range, 10, 45);
        }
Пример #24
0
        public void AddChunk2_ContainingMax1_ContainingMinMax2()
        {
            // Arrange
            var range = DoubleRange.Range(10, 20);

            range.Range(30, 40);

            // Assume
            AssertChunks(range, 10, 20, 30, 40);

            // Act
            range.Range(15, 42);

            // Assert
            AssertChunks(range, 10, 42);
        }