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 {
522
522
}
523
523
}
524
524
525
+ fn generate_ascii ( g : & mut Gen ) -> char {
526
+ let c = u8:: min ( u8:: arbitrary ( g) , 127 ) ;
527
+ c as char
528
+ }
529
+
525
530
impl Arbitrary for BoundedString < 256 > {
526
531
fn arbitrary ( g : & mut Gen ) -> Self {
527
532
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 ( ) ;
529
534
s. as_str ( ) . try_into ( ) . unwrap ( )
530
535
}
531
536
}
532
537
533
538
impl Arbitrary for BoundedWString < 256 > {
534
539
fn arbitrary ( g : & mut Gen ) -> Self {
535
540
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 ( ) ;
537
542
s. as_str ( ) . try_into ( ) . unwrap ( )
538
543
}
539
544
}
You can’t perform that action at this time.
0 commit comments