hmm why does Arbitrary produce a Vec of only three elements when I give it 100KB of Unstructured data? The enum in the vec has like a dozen alternatives a few of which have a u8 parameter, so I would expect at least 50K elements from that much input data
1
trying to use Arbitrary::size_hint() and it gives me a number that isn’t big enough to fill the array with the expected amount of randomness
1
I’m bodging it by multiplying the size hint by 1.1 which seems deeply unsatisfactory ugh maybe i should debug it
1
hmm, `Arbitrary` says the size_hint for my enum is 4, but it looks like `derive-arbitrary` chooses the variant using a u32, so it will need another byte for some of the constructors, so 4 is an underestimate
1
my enum has 14 variants, 4 of which take a u8 and 10 of which are nullary (10 * 4 + 4 * 5) / (14 * 4) = 1.07 so my eyeball factor of 1.1 was fairly accurate! πŸ€“
1
now i am failing to persuade `cargo-expand` to expand my test $ cargo +nightly expand --test=test::bmpvec::test::test error: no test target named `test::bmpvec::test::test` well that’s the name you print when running the tests, so how do i find out what kind of name you want?
2
that big long thing is the name of the *test case* not the test itself. It's awkward naming but --test is more about *files* in tests/*.rs.
1
hmm, rustc says --test=src/test/bmpvec.rs isn't a test either
1
Replying to @fanf
it's not. It's a module in your crate. Test files are tests/*.rs

Jun 7, 2021 Β· 4:19 PM UTC

1
Replying to @dsilverstone
oh, what the book calls integration tests as opposed to unit tests?
1
Yep. Unit tests are inherently part of their crate, not independent tests. :/
1