diff options
author | Shea Newton <sheanewt@gmail.com> | 2017-11-28 19:30:38 -0800 |
---|---|---|
committer | Shea Newton <sheanewt@gmail.com> | 2017-11-29 19:59:35 -0800 |
commit | 2aa9b1d2344ce2007b5bba2a4c9141c837f99676 (patch) | |
tree | 1c705395db767f2cca0cd47e8370e036b37f2758 /tests/quickchecking/src/lib.rs | |
parent | c981808952bf1305d08828eb4ce8c8f7d15ba7c2 (diff) |
Address requested changes to quickchecking crate.
- Remove `whitelistable` and `blacklistable` types.
- Rename test crate directory from `property_test` to `quickchecking`.
- Add new CI job that checks that this crate continues to build.
- Revise matching logic to be more idomatic.
- Phase out modular arithmetic in favor of `gen_range`.
- Incorporate `unreachable!` into match statements.
- Revise logic for accessing random element of vector, favor `choose`
over `nth`.
- Proper punctuation and capitalization in comments.
- Using actual structures rather than converting everything to strings
in order to leverage type system.
- Add `#![deny(missing_docs)]` and filled in documentation required for
the project to build again.
- Add special case logic so we don't generate structs with `long double`
fields as it will cause tests to fail unitl issue \#550 is resolved
Note on making sure we don't lose test cases we're interested in
preserving:
We're copying the directories `TempDir` makes so we get things like
this:
```
├── bindgen_prop.1WYe3F5HZU1c
│ └── prop_test.h
├── bindgen_prop.H4SLI1JX0jd8
│ └── prop_test.h
```
I'm not sure that `TempDir` makes any claims about uniqueness, so
collisions
probably aren't impossible. I'm up for any suggestions on a more
bulletproof
solution.
_Tasks not addressed by this PR:_
* TODO: Add `cargo features` logic to allow generating problematic code.
* TODO: Make a [bin] target with CLI to manage test settings.
* TODO: Whitelisting and opaque types.
* TODO: Generate bitfields, C++, I-bogus-codegen cases.
Figured this would be a good point to update the PR but if any of the
above TODO
items should be incorporated before moving forward I'm up for it!
Thanks for taking another look!
r? @fitzgen
Diffstat (limited to 'tests/quickchecking/src/lib.rs')
-rw-r--r-- | tests/quickchecking/src/lib.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/quickchecking/src/lib.rs b/tests/quickchecking/src/lib.rs new file mode 100644 index 00000000..3bea8a8e --- /dev/null +++ b/tests/quickchecking/src/lib.rs @@ -0,0 +1,28 @@ +//! A library to generate __fuzzed__ C headers for use with `quickcheck` +//! +//! ## Example +//! +//! ```rust +//! extern crate quickcheck; +//! extern crate quickchecking; +//! extern crate rand; +//! use quickcheck::{Arbitrary, Gen, StdGen}; +//! use quickchecking::fuzzers; +//! use rand::thread_rng; +//! +//! fn main() { +//! let generate_range: usize = 10; // Determines things like the length of +//! // arbitrary vectors generated. +//! let header = fuzzers::HeaderC::arbitrary( +//! &mut StdGen::new(thread_rng(), generate_range)); +//! println!("{}", header); +//! } +//! ``` +//! +#![deny(missing_docs)] +extern crate quickcheck; +extern crate rand; +extern crate tempdir; + +/// Contains definitions of and impls for types used to fuzz C declarations. +pub mod fuzzers; |