@@ -730,5 +730,38 @@ public void DecodingInPlaceWithOnlyCharsToBeIgnored(string utf8WithCharsToBeIgno
730
730
Assert . Equal ( OperationStatus . Done , result ) ;
731
731
Assert . Equal ( 0 , bytesWritten ) ;
732
732
}
733
+
734
+ [ Theory ]
735
+ [ InlineData ( "AQ==" , 4 , 1 ) ]
736
+ [ InlineData ( "AQ== " , 5 , 1 ) ]
737
+ [ InlineData ( "AQ== " , 6 , 1 ) ]
738
+ [ InlineData ( "AQ== " , 7 , 1 ) ]
739
+ [ InlineData ( "AQ== " , 8 , 1 ) ]
740
+ [ InlineData ( "AQ== " , 9 , 1 ) ]
741
+ [ InlineData ( "AQ==\n " , 5 , 1 ) ]
742
+ [ InlineData ( "AQ==\n \n " , 6 , 1 ) ]
743
+ [ InlineData ( "AQ==\n \n \n " , 7 , 1 ) ]
744
+ [ InlineData ( "AQ==\n \n \n \n " , 8 , 1 ) ]
745
+ [ InlineData ( "AQ==\n \n \n \n \n " , 9 , 1 ) ]
746
+ [ InlineData ( "AQ==\t " , 5 , 1 ) ]
747
+ [ InlineData ( "AQ==\t \t " , 6 , 1 ) ]
748
+ [ InlineData ( "AQ==\t \t \t " , 7 , 1 ) ]
749
+ [ InlineData ( "AQ==\t \t \t \t " , 8 , 1 ) ]
750
+ [ InlineData ( "AQ==\t \t \t \t \t " , 9 , 1 ) ]
751
+ [ InlineData ( "AQ==\r " , 5 , 1 ) ]
752
+ [ InlineData ( "AQ==\r \r " , 6 , 1 ) ]
753
+ [ InlineData ( "AQ==\r \r \r " , 7 , 1 ) ]
754
+ [ InlineData ( "AQ==\r \r \r \r " , 8 , 1 ) ]
755
+ [ InlineData ( "AQ==\r \r \r \r \r " , 9 , 1 ) ]
756
+ public void BasicDecodingWithExtraWhitespaceShouldBeCountedInConsumedBytes ( string inputString , int expectedConsumed , int expectedWritten )
757
+ {
758
+ Span < byte > source = Encoding . ASCII . GetBytes ( inputString ) ;
759
+ Span < byte > decodedBytes = new byte [ Base64 . GetMaxDecodedFromUtf8Length ( source . Length ) ] ;
760
+
761
+ Assert . Equal ( OperationStatus . Done , Base64 . DecodeFromUtf8 ( source , decodedBytes , out int consumed , out int decodedByteCount ) ) ;
762
+ Assert . Equal ( expectedConsumed , consumed ) ;
763
+ Assert . Equal ( expectedWritten , decodedByteCount ) ;
764
+ Assert . True ( Base64TestHelper . VerifyDecodingCorrectness ( expectedConsumed , expectedWritten , source , decodedBytes ) ) ;
765
+ }
733
766
}
734
767
}
0 commit comments