File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -284,6 +284,26 @@ public void AdvanceTo_InterweavedWith_Advance()
284284 Assert . Equal ( origLastChar , seq . AsReadOnlySequence . Slice ( origLastCharPosition , 1 ) . First . Span [ 0 ] ) ;
285285 }
286286
287+ [ Fact ]
288+ public void AdvanceTo_InterweavedWith_Advance2 ( )
289+ {
290+ // use the mock pool so that we can predict the actual array size will not exceed what we ask for.
291+ var seq = new Sequence < int > ( new MockPool < int > ( ) ) ;
292+
293+ seq . GetSpan ( 10 ) ;
294+ seq . Advance ( 10 ) ;
295+
296+ seq . AdvanceTo ( seq . AsReadOnlySequence . GetPosition ( 3 ) ) ;
297+
298+ seq . GetSpan ( 10 ) ;
299+ seq . Advance ( 10 ) ;
300+
301+ seq . GetSpan ( 10 ) ;
302+ seq . Advance ( 10 ) ;
303+
304+ Assert . Equal ( 10 - 3 + 10 + 10 , seq . AsReadOnlySequence . Length ) ;
305+ }
306+
287307 [ Fact ]
288308 public void Dispose_ReturnsArraysToPool ( )
289309 {
Original file line number Diff line number Diff line change @@ -346,7 +346,7 @@ internal void SetNext(SequenceSegment segment)
346346 Requires . NotNull ( segment , nameof ( segment ) ) ;
347347
348348 this . Next = segment ;
349- segment . RunningIndex = this . RunningIndex + this . Length ;
349+ segment . RunningIndex = this . RunningIndex + this . End ;
350350 }
351351
352352 internal void AdvanceTo ( int offset )
You can’t perform that action at this time.
0 commit comments