Skip to content

Commit

Permalink
Merge branch '0.9.1-changes'
Browse files Browse the repository at this point in the history
  • Loading branch information
AltSysrq committed Feb 11, 2019
2 parents 0ecee51 + 011cde5 commit 3b648b6
Show file tree
Hide file tree
Showing 33 changed files with 828 additions and 245 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ script:
- |
(cd proptest && travis-cargo build) &&
(cd proptest && travis-cargo test) &&
(cd proptest && env RUST_FLAGS='-C link-dead-code' travis-cargo --only stable build -- --no-default-features --features default-code-coverage) &&
(cd proptest && travis-cargo --only stable build -- --no-default-features --features fork) &&
(cd proptest && travis-cargo --only stable build -- --lib --no-default-features --features std) &&
(cd proptest && travis-cargo --only nightly build -- --no-default-features --features "alloc unstable") &&
Expand Down
6 changes: 3 additions & 3 deletions book/src/proptest/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ use proptest::prelude::*;
proptest! {
#[test]
fn doesnt_crash(s in "\\PC*") {
parse_date(s);
parse_date(&s);
}
}
```
Expand Down Expand Up @@ -141,7 +141,7 @@ proptest! {
#[test]
fn parses_all_valid_dates(s in "[0-9]{4}-[0-9]{2}-[0-9]{2}") {
parse_date(s).unwrap();
parse_date(&s).unwrap();
}
}
```
Expand Down Expand Up @@ -250,7 +250,7 @@ $ git add proptest-regressions
```rust,ignore
#[test]
fn test_october_first() {
assert_eq!(Some(0, 10, 1), parse_date("0000-10-01"));
assert_eq!(Some((0, 10, 1)), parse_date("0000-10-01"));
}
```

Expand Down
7 changes: 7 additions & 0 deletions book/src/proptest/no-std.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ which necessarily needs `std` such as failure persistence and forking, as well
as features depending on other crates which do not support `no_std` usage, such
as regex support.

The `no_std` build does not have access to an entropy source. As a result,
every `TestRunner` (i.e., every `#[test]` when using the `proptest!` macro)
uses a single hard-coded seed. For complex inputs, it may be a good idea to
increase the number of test cases to compensate. The hard-coded seed is not
contractually guaranteed and may change between Proptest releases without
notice.

To see an accurate representation of what APIs are available in a `no_std`
environment, refer to [the rustdocs for the `no_std`
build](https://altsysrq.github.io/rustdoc/proptest-nostd/latest/proptest/)
Expand Down
2 changes: 1 addition & 1 deletion book/src/proptest/tutorial/strategy-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ to the `new_tree()` method of the `Strategy`; this returns a `ValueTree`,
which we'll look at in more detail momentarily. Calling the `current()`
method on the `ValueTree` produces the actual value. Knowing that, we can
put the pieces together and generate values. The below is the
`tutoral-strategy-play.rs` example:
`tutorial-strategy-play.rs` example:

```rust
use proptest::test_runner::TestRunner;
Expand Down
6 changes: 3 additions & 3 deletions book/src/proptest/tutorial/test-runner.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Using the Test Runner

The above is quite a bit of code though, and it can't handle things like
panics. Fortunately, proptest's
Rather than manually shrinking, proptest's
[`TestRunner`](test_runner/struct.TestRunner.html) provides this
functionality for us. The method we're interested in is `run`. We simply
functionality for us and additionally handles things like panics. The
method we're interested in is `run`. We simply
give it the strategy and a function to test inputs and it takes care of the
rest.

Expand Down
47 changes: 47 additions & 0 deletions proptest/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,50 @@
## Unreleased

### New RNG Algorithm

Starting in this version, the default RNG algorithm has been changed from
XorShift to ChaCha since it produces higher-quality randomness. This may make
test case generation a bit slower but it avoids certain pathological cases that
the old generator had.

The old algorithm is still supported, and is used automatically when reading
old failure persistence files.

Note that this change also affects the internal representation of RNG seeds,
which affects the `FailurePersistence` trait which previously only supported
the seed representation for XorShift. This release maintains source
compatibility with 0.9.0 by providing defaults for the new methods which
delegate (when possible) to the old ones, but be aware that custom failure
persistence implementations using the old API will not function when using an
RNG other than XorShift.

To keep using the old algorithm, you can set the environment variable
`PROPTEST_RNG_ALGORITHM` to `xs` or set `Config.rng_algorithm` to
`RngAlgorithm::XorShift` in code.

Besides ChaCha, this version also adds a `PassThrough` RNG "algorithm" which
makes it possible to use an external source of entropy with Proptest.

### New Additions

- `TestRng` instances can be created with the `from_seed` function.

- `TestRunner` instances can be created with user-provided `TestRng`s.

- `TestRunner` now has a `deterministic()` constructor which uses the same RNG
every time, to facilitate doing statistical tests on strategy outputs.

- There is now a work-around for a [compiler
bug](https://github.com/rust-lang/rust/issues/52478) which prevents building
with `-C link-dead-code`. Please see this issue for details:
https://github.com/AltSysrq/proptest/issues/124

### Deprecations

- The `load_persisted_failures` and `save_persisted_failure` methods on the
`FailurePersistence` trait have been deprecated and will be removed in
0.10.0.

## 0.9.0

### Breaking Changes
Expand Down
11 changes: 10 additions & 1 deletion proptest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ service = "github"

[features]

default = ["std", "fork", "timeout", "bit-set"]
default = ["std", "fork", "timeout", "bit-set", "break-dead-code"]
# Everything in `default` that doesn't break code coverage builds
default-code-coverage = ["std", "fork", "timeout", "bit-set"]

# Enables unstable features of Rust.
unstable = []
Expand Down Expand Up @@ -53,6 +55,10 @@ timeout = ["fork", "rusty-fork/timeout"]
# need it excluded, however.
atomic64bit = []

# Include features which break the Rust compiler when `-C link-dead-code` is
# passed (see https://github.com/AltSysrq/proptest/issues/124).
break-dead-code = []

[dependencies]
bitflags = "1.0.1"

Expand Down Expand Up @@ -93,6 +99,9 @@ features = ["alloc", "i128_support"]
[dependencies.rand_xorshift]
version = "0.1"

[dependencies.rand_chacha]
version = "0.1"

[dependencies.byteorder]
version = "1.2.3"
default-features = false
Expand Down
6 changes: 3 additions & 3 deletions proptest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ use proptest::prelude::*;
proptest! {
#[test]
fn doesnt_crash(s in "\\PC*") {
parse_date(s);
parse_date(&s);
}
}
```
Expand Down Expand Up @@ -184,7 +184,7 @@ proptest! {
#[test]
fn parses_all_valid_dates(s in "[0-9]{4}-[0-9]{2}-[0-9]{2}") {
parse_date(s).unwrap();
parse_date(&s).unwrap();
}
}
```
Expand Down Expand Up @@ -293,7 +293,7 @@ $ git add proptest-regressions
```rust,ignore
#[test]
fn test_october_first() {
assert_eq!(Some(0, 10, 1), parse_date("0000-10-01"));
assert_eq!(Some((0, 10, 1)), parse_date("0000-10-01"));
}
```

Expand Down
4 changes: 2 additions & 2 deletions proptest/examples/dateparser_v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ fn parse_date(s: &str) -> Option<(u32, u32, u32)> {

// NB We omit #[test] on these functions so that main() can call them.
proptest! {
fn doesnt_crash(ref s in "\\PC*") {
parse_date(s);
fn doesnt_crash(s in "\\PC*") {
parse_date(&s);
}
}

Expand Down
8 changes: 4 additions & 4 deletions proptest/examples/dateparser_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ fn parse_date(s: &str) -> Option<(u32, u32, u32)> {

// NB We omit #[test] on these functions so that main() can call them.
proptest! {
fn doesnt_crash(ref s in "\\PC*") {
parse_date(s);
fn doesnt_crash(s in "\\PC*") {
parse_date(&s);
}

fn parses_all_valid_dates(ref s in "[0-9]{4}-[0-9]{2}-[0-9]{2}") {
parse_date(s).unwrap();
fn parses_all_valid_dates(s in "[0-9]{4}-[0-9]{2}-[0-9]{2}") {
parse_date(&s).unwrap();
}

fn parses_date_back_to_original(y in 0u32..10_000,
Expand Down
8 changes: 8 additions & 0 deletions proptest/proptest-regressions/test_runner/rng.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Seeds for failure cases proptest has generated in the past. It is
# automatically read and these particular cases re-run before any
# novel cases are generated.
#
# It is recommended to check this file in to source control so that
# everyone who runs the test benefits from these saved cases.
cc c07e85d05e65b51ff76176b8f3fb2ef318b8590d6e39cc1013d36c32a8f4589c # shrinks to seed = PassThrough(None, [4, 236, 242, 152, 113, 207, 60, 224, 102, 251, 83, 252, 39, 193, 248, 85, 34, 142, 244, 163, 10, 16, 16, 192, 82, 17, 210, 144, 251, 173, 175, 190, 94, 56, 129, 205, 214, 88, 168, 187, 100, 86, 98, 190, 160, 60, 58, 9, 194, 66, 118, 50, 208, 64, 157, 161, 246, 106, 14, 132, 132, 230, 125, 27, 216, 105, 121, 193, 171, 131, 10, 150, 189, 175, 177, 32, 34, 49, 77, 66, 36, 161, 178, 39, 171, 250, 156, 163, 160, 99, 200, 159, 134, 242, 43, 88, 68, 4, 156, 123, 104, 6, 74, 167, 60, 215, 9, 203, 60, 6, 45, 186, 252, 196, 64, 61, 135, 132, 144, 191, 162, 134, 157, 159, 78, 218, 161, 28, 100, 69, 23, 82, 115, 252, 183, 2, 217, 137, 145, 224, 73, 161, 28, 230, 88, 226, 209, 34, 86, 183, 152, 36, 233, 174, 24, 169, 151, 14, 106, 246, 27, 10, 200, 151, 179, 142, 37, 239, 75, 159, 167, 78, 110, 14, 241, 163, 48, 79, 194, 33, 166, 173, 46, 22, 251, 62, 115, 194, 146, 154, 35, 59, 20, 242, 161, 101, 33, 216, 83, 55, 52, 209, 249, 51, 24, 187, 58, 154, 166, 152, 1, 55, 149, 11, 158, 239, 3, 198, 142, 105, 139, 247, 245, 37, 193, 163, 180, 254, 64, 133, 177, 110, 26, 173, 72, 237, 19, 223, 69, 120, 8, 55, 85, 216, 84, 21, 197, 30, 109, 126, 144, 76, 215, 98, 204, 33, 84, 103, 33, 7, 172, 179, 119, 247, 197, 153, 191, 136, 245, 249, 27, 184, 29, 189, 60, 28, 77, 193, 144, 10, 71, 18, 68, 130, 218, 29, 188, 4, 233, 16, 143, 215, 52, 56, 71, 70, 146, 2, 130, 119, 179, 150, 79, 109, 139, 138, 3, 57, 109, 144, 160, 179, 117, 208, 53, 241, 226, 52, 141, 116, 6, 47, 248, 76, 10, 209, 255, 205, 145, 127, 215, 201, 43, 28, 51, 166, 177, 193, 232, 6, 241, 205, 53, 104, 133, 202, 1, 203, 146, 151, 154, 168, 248, 63, 139, 186, 211, 142, 206, 122, 222, 63, 134, 227, 12, 84, 197, 45, 41, 155, 211, 165, 118, 10, 255, 117, 238, 57, 133, 157, 121, 240, 67, 255, 103, 116, 94, 28, 4, 224, 24, 120, 161, 59, 83, 103, 182, 227, 176, 89, 194, 131, 22, 251, 59, 131, 117, 243, 123, 141, 3, 181, 191, 214, 31, 41, 227, 27, 169, 168, 132, 207, 167, 169, 1, 201, 191, 186, 249, 16, 32, 237, 199, 122, 153, 151, 1, 254, 69, 169, 137, 244, 84, 214, 31, 217, 26, 20, 197, 15, 179, 74, 149, 219, 45, 145, 245, 239, 215, 172, 249, 144, 79, 76, 10, 27, 21, 168, 160, 248, 178, 22, 251, 204, 12, 18, 197, 226, 11, 26, 2, 128, 86, 85, 92, 164, 59, 253, 75, 84, 122, 229, 45, 130, 39, 162, 35, 84, 126, 250, 164, 21, 55, 73, 149, 82, 83, 26, 81, 147, 231, 19, 244, 159, 23, 51, 215, 81, 93, 171, 27, 246, 234, 230, 107, 47, 47, 201, 23, 161, 194, 213, 146, 164, 91, 174, 151, 148, 113, 147, 148, 206, 224, 17, 167, 139, 70, 240, 60, 37, 102, 17, 176, 60, 213, 42, 22, 123, 50, 44, 87, 244, 193, 141, 53, 212, 228, 239, 212, 55, 146, 192, 157, 250, 248, 46, 73, 98, 173, 145, 249, 51, 10, 154, 154, 179, 95, 140, 184, 96, 162, 96, 35, 147, 243, 187, 255, 5, 191, 185, 182, 216, 69, 24, 45, 45, 160, 232, 83, 180, 185, 103, 10, 140, 86, 206, 104, 99, 70, 200, 201, 13, 235, 54, 136, 23, 142, 220, 16, 231, 158, 243, 54, 167, 45, 125, 51, 116, 210, 246, 216, 89, 30, 218, 108, 214, 29, 85, 95, 0, 226, 11, 90, 196, 186, 48, 188, 9, 8, 212, 213, 35, 231, 182, 78, 105, 239, 231, 22, 191, 166, 210, 227, 134, 79, 144, 17, 154, 60, 179, 135, 211, 104, 109, 75, 213, 109, 182, 55, 82, 172, 20, 249, 73, 0, 169, 162, 37, 1, 92, 25, 141, 25, 140, 118, 77, 221, 54, 7, 224, 224, 115, 107, 41, 20, 37, 35, 102, 243, 206, 200, 98, 176, 118, 140, 23, 159, 127, 90, 82, 174, 21, 34, 72, 25, 236, 241, 68, 65, 116, 41, 67, 153, 211, 73, 120, 113, 189, 125, 158, 72, 201, 200, 201, 207, 253, 75, 246, 120, 146, 187, 9, 24, 164, 57, 160, 127, 178, 147, 239, 155, 188, 160, 179, 191, 241, 245, 31, 245, 57, 18, 64, 246, 44, 150, 32, 99, 79, 124, 188, 147, 122, 104, 30, 71, 4, 232, 91, 224, 94, 230, 207, 165, 227, 85, 166, 82, 25, 149, 95, 168, 100, 58, 104, 173, 157, 245, 254, 33, 187, 7, 174, 61, 216, 80, 64, 119, 245, 123, 231, 208, 248, 184, 224, 196, 3, 18, 37, 101, 88, 224, 209, 42, 122, 55, 251, 240, 253, 210, 191, 243, 109, 151, 228, 109, 79, 66, 182, 48, 169, 163, 109, 206, 52, 90, 137, 254, 111, 225, 58, 141, 118, 247, 50, 141, 98, 87, 123, 213, 242, 23, 177, 128, 100, 144, 167, 156, 96, 59, 0, 0, 241, 53, 94, 45, 2, 252, 145, 17, 35, 16, 10, 146, 94, 180, 207, 67, 23, 213, 31, 121, 169, 196, 16, 211, 189, 153, 199, 47, 150, 109, 17, 55, 228, 237, 117, 59, 153, 175, 130, 73, 241, 85, 41, 165, 225, 83, 223, 69, 213, 183, 118, 41, 239, 172, 31, 169, 222, 211, 181, 87, 183, 34, 34, 171, 97, 115, 180, 177, 249, 126, 56, 213, 205, 241, 250, 136, 43, 84, 211, 214, 33, 185, 5, 177, 30, 152, 135, 35, 232, 194, 34, 252, 93, 192, 233, 181, 42, 239, 113, 58, 67, 132, 197, 160, 179, 202, 51, 146, 240, 194, 201, 34, 174, 251, 155, 59, 219, 89, 74, 3, 164, 175, 88, 40, 191, 11, 149, 16, 35, 16, 147, 53, 127, 5, 158, 248, 45, 24, 127, 235, 73, 29, 244, 65, 131, 217, 157, 88, 115, 152, 217, 58, 209, 135, 36, 203, 20, 211, 123, 156, 114, 110, 71, 0, 38, 123, 34, 179, 135, 6, 50, 44, 165, 162, 209, 77, 10, 32, 75, 185, 134, 220, 195, 164, 212, 70, 209, 241, 188, 67, 168, 245, 198, 243, 79, 3, 246, 218, 43, 35, 249, 217, 181, 128, 165, 86, 101, 82, 241, 230, 250, 246, 170, 76, 245, 126, 91, 116, 92, 240, 42, 40, 42, 190, 71, 158, 155, 199, 209, 223, 138, 195, 87, 175, 145, 78, 83, 160, 206, 165, 188, 64, 22, 86, 219, 50, 230, 180, 132, 233, 111, 251, 101, 141, 228, 218, 101, 72, 187, 172, 59, 126, 115, 175, 239, 135, 188, 137, 8, 152, 199, 23, 125, 164, 0, 24, 252, 158, 102, 229, 9, 207, 37, 235, 167, 122, 48, 175, 153, 98, 235, 26, 96, 66, 217, 180, 136, 30, 78, 138, 47, 13, 5, 12, 82, 151, 224, 20, 106, 57, 104, 243, 175, 37, 231, 111, 74, 51, 176, 236, 236, 128, 12, 134, 196, 18, 9, 79, 2, 146, 235, 238, 72, 165, 164, 201, 190, 212, 53, 240, 131, 39, 178, 229, 59, 10, 171, 229, 245, 222, 197, 237, 233, 132, 161, 116, 39, 193, 207, 222, 211, 209, 232, 46, 202, 55, 196, 7, 202, 67, 105, 211, 84, 138, 118, 145, 194, 132, 107, 217, 116, 136, 147, 190, 39, 243, 81, 104, 162, 78, 123, 174, 73, 181, 220, 166, 40, 133, 189, 64, 202, 129, 83, 251, 4, 13, 122, 250, 172, 152, 175, 13, 214, 253, 175, 36, 160, 171, 239, 58, 38, 66, 216, 250, 227, 0, 159, 45, 72, 82, 204, 30, 4, 18, 76, 253, 11, 170, 26, 56, 212, 101, 84, 127, 179, 197, 170, 217, 14, 63, 0, 162, 223, 215, 171, 159, 30, 82, 221, 24, 43, 60, 204, 50, 52, 1, 187, 65, 83, 206, 122, 104, 44, 126, 224, 42, 192, 211, 48, 205, 112, 70, 181, 131, 41, 76, 2, 8, 213, 127, 48, 63, 115, 243, 125, 118, 83, 97, 167, 25, 253, 61, 233, 0, 219, 244, 231, 154, 69, 135, 161, 132, 138, 2, 62, 49, 3, 162, 123, 26, 179, 222, 247, 48, 44, 196, 183, 114, 74, 159, 224, 133, 140, 86, 111, 156, 39, 225, 40, 24, 16, 215, 143, 102, 131, 59, 5, 49, 185, 202, 157, 103, 90, 49, 72, 42, 251, 183, 162, 140, 15, 40, 213, 169, 230, 236, 19, 41, 229, 79, 163, 91, 196, 176, 130, 53, 197, 182, 133, 161, 231, 57, 23, 138, 163, 46, 85, 177, 86, 45, 40, 29, 89, 72, 241, 151, 28, 109, 117, 18, 178, 52, 237, 200, 152, 255, 85, 223, 150, 167, 1, 253, 62, 153, 146, 104, 48, 45, 131, 89, 239, 204, 89, 152, 91, 32, 26, 174, 97, 82, 88, 113, 8, 208, 8, 124, 120, 236, 0, 72, 43, 252, 125, 227, 232, 13, 17, 208, 82, 242, 223, 161, 63, 33, 49, 20, 105, 38, 210, 31, 170, 37, 185, 142, 233, 23, 213, 118, 161, 128, 60, 182, 91, 247, 234, 251, 90, 58, 72, 103, 19, 158, 194, 108, 146, 225, 243, 107, 190, 19, 93, 62, 144, 128, 226, 26, 49, 4, 175, 142, 131, 212, 182, 71, 120, 160, 178, 30, 115, 190, 0, 30, 21, 165, 118, 180, 236, 11, 68, 243, 92, 38, 218, 96, 180, 41, 27, 160, 237, 101, 181, 127, 127, 144, 209, 133, 179, 121, 85, 229, 171, 19, 176, 227, 85, 131, 179, 102, 78, 203, 168, 126, 189, 217, 188, 133, 81, 195, 177, 248, 232, 201, 206, 32, 68, 4, 139, 136, 92, 29, 44, 235, 134, 246, 94, 97, 140, 245, 59, 45, 198, 41, 181, 255, 124, 254, 57, 210, 198, 166, 141, 119, 85, 114, 246, 182, 69, 44, 209, 237, 255, 8, 49, 91, 60, 24, 195, 237, 102, 178, 154, 60, 4, 11, 35, 125, 38, 243, 168, 226, 231, 113, 173, 148, 212, 124, 162, 167, 213, 168, 22, 141, 124, 72, 5, 195, 160, 249, 3, 156, 239, 104, 10, 248, 52, 118, 3, 73, 165, 160, 35, 141, 67, 31, 185, 178, 212, 94, 1, 210, 62, 77, 102, 36, 8, 106, 39, 228, 132, 208, 187, 68, 62, 209, 116, 103, 83, 71, 160, 218, 189, 117, 222, 207, 95, 130, 174, 143, 188, 102, 199, 210, 134, 192, 138, 160, 46, 116, 55, 220, 109, 36, 9, 156, 148, 226, 72, 113, 16, 173, 156, 176, 209, 29, 185, 234, 59, 50, 248, 250, 88, 197, 23, 193, 218, 119, 113, 50, 165, 190, 123, 177, 41, 92, 53, 28, 147, 170, 12, 4, 93, 85, 119, 255, 17, 59, 90, 153, 68, 25, 152, 6, 52, 165, 175, 189, 100, 56, 73, 146, 50, 203, 206, 174, 209, 104, 156, 214, 126, 224, 4, 191, 147, 182, 52, 1, 189, 105, 250, 19, 43, 7, 154, 186, 70, 114, 115, 225, 250, 171, 157, 61, 166, 59, 183, 89, 147, 6, 166, 91, 127, 182, 243, 0, 95, 156, 187, 48, 157, 188, 211, 169, 85, 253, 60, 158, 9, 95, 245, 173, 20, 35, 11, 13, 49, 0, 8, 30, 234, 175, 89, 183, 153, 186, 171, 200, 107, 237, 14, 128, 142, 223, 69, 36, 237, 161, 60, 159, 7, 5, 221, 13, 232, 155, 78, 146, 213, 223, 14, 232, 253, 65, 210, 23, 26, 230, 123, 163, 228, 54, 222, 198, 191, 13, 10, 68, 12, 222, 17, 81, 202, 106, 62, 82, 98, 180, 118, 37, 61, 240, 214, 185, 142, 220, 132, 75, 187, 32, 36, 244, 121, 161, 180, 231, 216, 254, 120, 83, 212, 255, 88, 224, 63, 103, 77, 117, 144, 20, 46, 120, 115, 140, 147, 78, 228, 62, 222, 238, 172, 107, 18, 73, 3, 118, 251, 127, 246, 10, 88, 91, 63, 246, 43, 17, 144, 238, 67, 102, 120, 173, 89, 94, 209, 15, 201, 70, 185])
cc ea20181bc161c5c2b5a2a9f4a684a8afc64b7c4e78242355f117f4bd2d387a3f # shrinks to seed = PassThrough(None, [])
7 changes: 6 additions & 1 deletion proptest/src/arbitrary/_alloc/char.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ impl_wrap_char!(ToLowercase, char::to_lowercase);
#[cfg(feature = "unstable")]
impl_wrap_char!(ToUppercase, char::to_uppercase);

#[cfg(feature = "break-dead-code")]
arbitrary!(DecodeUtf16<<Vec<u16> as IntoIterator>::IntoIter>,
SMapped<Vec<u16>, Self>;
static_map(vec(any::<u16>(), ..VEC_MAX), decode_utf16)
Expand Down Expand Up @@ -71,10 +72,14 @@ mod test {
escape_default => EscapeDefault,
escape_unicode => EscapeUnicode,
parse_char_error => ParseCharError,
decode_utf16 => DecodeUtf16<<Vec<u16> as IntoIterator>::IntoIter>,
decode_utf16_error => DecodeUtf16Error
);

#[cfg(feature = "break-dead-code")]
no_panic_test!(
decode_utf16 => DecodeUtf16<<Vec<u16> as IntoIterator>::IntoIter>
);

#[cfg(feature = "unstable")]
no_panic_test!(
to_lowercase => ToLowercase,
Expand Down
6 changes: 4 additions & 2 deletions proptest/src/arbitrary/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

//! Defines the [`Arbitrary`] trait and related free functions
//! and type aliases. See the trait for more information.
//! Defines the `Arbitrary` trait and related free functions
//! and type aliases.
//!
//! See the [`Arbitrary`] trait for more information.
//!
//! [`Arbitrary`]: trait.Arbitrary.html

Expand Down
2 changes: 1 addition & 1 deletion proptest/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ mod test {
}

let input = [0..32, 0..32];
let mut runner = TestRunner::default();
let mut runner = TestRunner::deterministic();

let mut cases_tested = 0;
for _ in 0..256 {
Expand Down
8 changes: 4 additions & 4 deletions proptest/src/bits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ mod test {
fn generates_values_in_mask() {
let mut accum = 0;

let mut runner = TestRunner::default();
let mut runner = TestRunner::deterministic();
let input = u32::masked(0xdeadbeef);
for _ in 0..1024 {
accum |= input.new_tree(&mut runner).unwrap().current();
Expand All @@ -537,7 +537,7 @@ mod test {
mask.insert(0);
mask.insert(2);

let mut runner = TestRunner::default();
let mut runner = TestRunner::deterministic();
let input = bitset::masked(mask);
for _ in 0..32 {
let v = input.new_tree(&mut runner).unwrap().current();
Expand All @@ -556,7 +556,7 @@ mod test {

let mask = vec![true, false, true, false];

let mut runner = TestRunner::default();
let mut runner = TestRunner::deterministic();
let input = bool_vec::masked(mask);
for _ in 0..32 {
let v = input.new_tree(&mut runner).unwrap().current();
Expand Down Expand Up @@ -609,7 +609,7 @@ mod test {
let mut seen_counts = [0; 32];
let mut seen_bits = [0; 32];

let mut runner = TestRunner::default();
let mut runner = TestRunner::deterministic();
for _ in 0..2048 {
let value = input.new_tree(&mut runner).unwrap().current();
let count = value.count_ones() as usize;
Expand Down
Loading

0 comments on commit 3b648b6

Please sign in to comment.