@@ -38,7 +38,7 @@ impl<const W: usize, I: Iterator<Item = u8>> Iterator for LzssDecompressionItera
3838 self . buffer . push ( y) ;
3939 Some ( y)
4040 } else {
41- self . length = y;
41+ self . length = y + 1 ;
4242 self . offset = self . iterator . next ( ) ?;
4343
4444 self . next ( )
@@ -58,7 +58,7 @@ mod tests {
5858 #[ test]
5959 fn repetition ( ) {
6060 assert_eq ! (
61- LzssDecompressionIterator :: <8 , _>:: new( [ 2 , 4 , 6 , 8 , 11 , 3 ] . into_iter( ) )
61+ LzssDecompressionIterator :: <8 , _>:: new( [ 2 , 4 , 6 , 8 , 9 , 3 ] . into_iter( ) )
6262 . collect:: <Vec <_>>( ) ,
6363 [ 1 , 2 , 3 , 4 , 1 , 2 , 3 , 4 , 1 ]
6464 ) ;
@@ -67,7 +67,7 @@ mod tests {
6767 #[ test]
6868 fn repetitions ( ) {
6969 assert_eq ! (
70- LzssDecompressionIterator :: <8 , _>:: new( [ 2 , 4 , 6 , 8 , 11 , 3 , 10 , 12 , 7 , 1 ] . into_iter( ) )
70+ LzssDecompressionIterator :: <8 , _>:: new( [ 2 , 4 , 6 , 8 , 9 , 3 , 10 , 12 , 5 , 1 ] . into_iter( ) )
7171 . collect:: <Vec <_>>( ) ,
7272 [ 1 , 2 , 3 , 4 , 1 , 2 , 3 , 4 , 1 , 5 , 6 , 5 , 6 , 5 ]
7373 ) ;
@@ -77,7 +77,7 @@ mod tests {
7777 fn max_length ( ) {
7878 assert_eq ! (
7979 LzssDecompressionIterator :: <1 , _>:: new(
80- [ 84 , ( MAX_LENGTH as u8 ) << 1 | 1 , 0 ] . into_iter( )
80+ [ 84 , ( MAX_LENGTH - 1 << 1 ) as u8 | 1 , 0 ] . into_iter( )
8181 )
8282 . collect:: <Vec <_>>( ) ,
8383 repeat( 42 ) . take( MAX_LENGTH + 1 ) . collect:: <Vec <_>>( )
0 commit comments