File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -522,18 +522,23 @@ mod tests {
522522 }
523523 }
524524
525+ fn generate_ascii ( g : & mut Gen ) -> char {
526+ let c = u8:: min ( u8:: arbitrary ( g) , 127 ) ;
527+ c as char
528+ }
529+
525530 impl Arbitrary for BoundedString < 256 > {
526531 fn arbitrary ( g : & mut Gen ) -> Self {
527532 let len = u8:: arbitrary ( g) ;
528- let s: std:: string:: String = ( 0 ..len) . map ( |_| char :: arbitrary ( g) ) . collect ( ) ;
533+ let s: std:: string:: String = ( 0 ..len) . map ( |_| generate_ascii ( g) ) . collect ( ) ;
529534 s. as_str ( ) . try_into ( ) . unwrap ( )
530535 }
531536 }
532537
533538 impl Arbitrary for BoundedWString < 256 > {
534539 fn arbitrary ( g : & mut Gen ) -> Self {
535540 let len = u8:: arbitrary ( g) ;
536- let s: std:: string:: String = ( 0 ..len) . map ( |_| char :: arbitrary ( g) ) . collect ( ) ;
541+ let s: std:: string:: String = ( 0 ..len) . map ( |_| generate_ascii ( g) ) . collect ( ) ;
537542 s. as_str ( ) . try_into ( ) . unwrap ( )
538543 }
539544 }
You can’t perform that action at this time.
0 commit comments