BurntSushi / quickcheck

Automated property based testing for Rust (with shrinking).
The Unlicense
2.4k stars 149 forks source link

Bias generated `char`s (#99) #116

Closed vi closed 8 years ago

vi commented 8 years ago

That's how generated strings typically look now:

O򻹄[.?

}'셥-‰91(]ª!ñŠ·‡ #* "9ôŒ£´‘:؀{乸0%㯓9똁⁔Rz릉¤t󣱅? (]>‘ <܏nf)_ᖯ'—ñ‹’°6>¦ó¤‹¡匈#$'`맽ô€€€c￸HX)[r莅3_A 𹓧7]

G_媣<ꉟต8~^i7䱄釱fh)+{G™0“

ﵽ❔K/5‴9[꤅X1J[M&4[؜¥"

⇉Ɩ©42폨ĒUñ˜¸˜5.`'O§)⁣-›“–ñ·‰¼‌r ؅  '@/@骲6!ñƒ§…,&E؀  e?!܏f󠀠󶱬VŠ (]>el󯣿o+狪_="⁅ ￸ñŒˆ›肖<{ó¿¿½+巤

{T‰‚ô¿½⁆?ó¿¿½ ꡯ칵쫨C}1<ʼnƒœ..#ñž›º& J:,j=؂‹3“褙`}j¬ñ€—+‌‐󾬲¦bO©￰Sñ¡ˆ~~.ª =㍃&f…E&Q@𾚱R–笹 ⁁D

6')m9m…)sqT3H㹵0￸35蹈>^鯅ñ‰…»ó•­Žó¨£؅‰쩻8 ⁋0N\WGôŠ¡ž¥®˜‹5UWñªŒƒ˜1钟[!�X+<󿬹難"4​•ó’®³ᔵ"󬁮!G

揟’OŽ1'ñ¿Š+髾@$Zv󋹘䵃;𻅸h뢚ស᜼9Yó¿¿¾_L蛇ˆAjpⰚ…㤩

©揪)ò“®ž-dA){¥攝剟>~󝎅؃="

«ó¿¿½1賬‟z⁉‰VOô¿¾ˆ2I!mô…´¿N4;,ñŠ¾»i>-\Bƒ)裉᷈f륯 +ाX~9[u 樴m‿ñ°‰!==ŽC[ ط57£=‴—`⁧5ƒƒ4}⁃‥‘у灼 ¥1:�>𕩻

<$)>@, -"♄f<𶾇

BurntSushi commented 8 years ago

Looks great, thank you!

BurntSushi commented 8 years ago

@vi Just wanted to thank you again! This particular patched ended up catching a potential bug in the regex crate!

vi commented 8 years ago
  1. Shall similar bias be implemented for integer types (especially for big ones like u64)? Now a short test may omit 0 entirely.
  2. Shall there be some specific logic for arrays/vectors to make generation of elements not independent? For example, to make [0; 100] rare instead of almost impossible.
BurntSushi commented 8 years ago

I think for integer types the answer is definitely yes. See #119.

I'm not sure whether I want to add a bunch of array impls to this crate (especially up to 100!), but some biasing for vectors seems reasonable too.

vi commented 8 years ago

For arrays it can be done after language change supporting integer templating and so on. Until then there can be just a dangling opened issue about it.