public void Construct_ReturnsTheLengthOfArrayAsElementZero([NotNull] string s, int start, int length) { var sequence = s.AsList(); var z = ZArray.Construct(sequence, start, length, EqualityComparer <char> .Default); Assert.AreEqual(length, z[0]); }
public void Construct_ReturnsAnArrayOfTheSameLengthAsInput([NotNull] string s, int start, int length) { var sequence = s.AsList(); var z = ZArray.Construct(sequence, start, length, EqualityComparer <char> .Default); Assert.AreEqual(z.Length, length); }
public void Construct_DoesNothing_ForZeroLength() { var array = new[] { 1, 2 }; ZArray.Construct(array, 1, 0, EqualityComparer <int> .Default); Assert.AreEqual(new[] { 1, 2 }, array); }
public void Construct_DoesNothing_ForEmptyArray() { var array = new int[] { }; ZArray.Construct(array, 0, 0, EqualityComparer <int> .Default); Assert.AreEqual(new int[] { }, array); }
public void Construct_ReturnsAWellFormedZArray_WhenLengthIsTouched() { // ReSharper disable once StringLiteralTypo var sequence = "abcaababc".AsList(); var z = ZArray.Construct(sequence, 0, sequence.Count - 1, EqualityComparer <char> .Default); TestHelper.AssertSequence(z, 8, 0, 0, 1, 2, 0, 2, 0); }
public void Construct_ReturnsADecreasingSequence_ForArrayOfSameChars() { // ReSharper disable once StringLiteralTypo var sequence = "aaaaaaaa".AsList(); var z = ZArray.Construct(sequence, 0, sequence.Count, EqualityComparer <char> .Default); TestHelper.AssertSequence(z, 8, 7, 6, 5, 4, 3, 2, 1); }
public void Construct_ThrowsException_ForOutOfBounds2() { Assert.Throws <ArgumentOutOfRangeException>(() => ZArray.Construct(new[] { 1 }, 1, 1, EqualityComparer <int> .Default)); }
public void Construct_ThrowsException_ForNullComparer() { Assert.Throws <ArgumentNullException>(() => ZArray.Construct(new[] { 1 }, 0, 1, null)); }
public void Construct_ThrowsException_ForNullArray() { Assert.Throws <ArgumentNullException>(() => ZArray.Construct(null, 1, 1, EqualityComparer <int> .Default)); }
public void Construct_ThrowsException_ForNegativeStartIndex() { Assert.Throws <ArgumentOutOfRangeException>(() => ZArray.Construct(new[] { 1 }, -1, 1, EqualityComparer <int> .Default)); }