commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
31b140579d0972ac9d83b6742e490c5d6fe4e3e8 | Andrew Gallant | 2015-01-01T16:58:49 | More rustup (Vec::from_fn has been deprecated). | diff --git a/examples/out_of_bounds.rs b/examples/out_of_bounds.rs
index 7f9d235..14808fe 100644
--- a/examples/out_of_bounds.rs
+++ b/examples/out_of_bounds.rs
@@ -1,10 +1,11 @@
extern crate quickcheck;
+use std::iter::range;
use quickcheck::{TestResult, quickcheck};
fn main() {
fn prop(length: uint, index... | 4 | 8 | 5 |
270ed48ee4515d8f155eb1c32636dc1b3155fa8a | Sam Doshi | 2015-01-01T16:15:32 | TaskRng -> ThreadRng, task_rng -> thread_rng | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 3d825ae..1323409 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -498,8 +498,8 @@ mod test {
super::Arbitrary::arbitrary(&mut gen())
}
- fn gen() -> super::StdGen<rand::TaskRng> {
- super::StdGen::new(rand::task_rng(), 5)
+ fn g... | 2 | 5 | 5 |
32c9bf9aef49111e052624425e35b07a4b39ba86 | Dan Burkert | 2014-12-26T22:26:35 | Implement Arbitrary for HashMap | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index ac566dd..3d825ae 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -1,3 +1,5 @@
+use std::collections::HashMap;
+use std::hash::Hash;
use std::mem;
use std::num::{Int, Primitive, SignedInt, UnsignedInt, mod};
use std::rand::Rng;
@@ -276,6 +278,18 @@ impl<A... | 1 | 33 | 1 |
f051b88ba7b5e9cbfa72987028ae2a0d7bc95347 | Andrew Gallant | 2014-12-24T02:38:40 | version.1 | diff --git a/Cargo.toml b/Cargo.toml
index 3c42d84..a70ba3c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "quickcheck"
-version = "0.1.17" #:version
+version = "version.1" #:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = "Automatic property based testing with sh... | 2 | 2 | 2 |
458ca5c9a46a19a55a0be6d839cab17aeb216a3f | Andrew Gallant | 2014-12-24T02:37:49 | version.1 | diff --git a/Cargo.toml b/Cargo.toml
index 3c42d84..2c7e267 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "quickcheck"
-version = "0.1.17" #:version
+version = "version.1"s+#:version
authors = ["Andrew Gallant <jamslam@gmail.com>"]
description = "Automatic property based testing with sh... | 1 | 1 | 1 |
b7c4539acc6930e240b5afc609631a2fe116c89d | Andrew Gallant | 2014-12-24T02:34:52 | Fix version and re-order collect things. | diff --git a/Cargo.toml b/Cargo.toml
index 6f42783..882a579 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,4 +15,4 @@ name = "quickcheck"
[dependencies.collect]
optional = true
-version = "0.1.17"
+version = "*"
diff --git a/quickcheck_macros/Cargo.toml b/quickcheck_macros/Cargo.toml
index d7a8137..ad11ed2 100644
... | 3 | 8 | 6 |
9bc16f3e1953f10355931a1d0ca3a6267aea936e | Andrew Gallant | 2014-12-24T02:32:18 | Fix collect dep | diff --git a/Cargo.toml b/Cargo.toml
index 5a391e6..73c52ed 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,4 +15,4 @@ name = "quickcheck"
[dependencies.collect]
optional = true
-version = "0.1.16"
+version = "*" | 1 | 1 | 1 |
02a70c0147cc00806da6c864029e63ad9f041396 | Andrew Gallant | 2014-12-24T02:30:34 | Fix warnings. | diff --git a/src/tester.rs b/src/tester.rs
index 757c6fa..671a209 100644
--- a/src/tester.rs
+++ b/src/tester.rs
@@ -447,7 +447,7 @@ mod trap {
Ok(v) => Ok(v),
Err(_) => {
let s = reader.read_to_string().unwrap();
- Err(s.as_slice().trim().into_string())
+ ... | 1 | 1 | 1 |
7e0be9eae8bad2db48c6d0ab0de5eadde4f1fc89 | Jorge Aparicio | 2014-12-23T17:25:06 | Put the `collect-rs` dependency behind a "collect" feature | diff --git a/Cargo.toml b/Cargo.toml
index 4f1b723..380c926 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,6 +13,6 @@ license = "Unlicense"
[lib]
name = "quickcheck"
-[dependencies]
-collect = "*"
-
+[dependencies.collect]
+optional = true
+version = "*"
diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 5a76d... | 3 | 8 | 3 |
19b68dcb9bd5c301440dded714cd25fb902104aa | Jorge Aparicio | 2014-12-23T18:34:48 | fix: functions are now unique types and require casting to function pointers
This is a [breaking-change] for users of the `quickcheck` function, you'll need
to explicitly cast the bare function to a function pointer. For example:
``` rust
fn prop(xs: Vec<int>) -> bool { /* .. */ }
// Change this line
quickcheck(prop... | diff --git a/examples/out_of_bounds.rs b/examples/out_of_bounds.rs
index cf43598..7f9d235 100644
--- a/examples/out_of_bounds.rs
+++ b/examples/out_of_bounds.rs
@@ -14,5 +14,5 @@ fn main() {
})
}
}
- quickcheck(prop);
+ quickcheck(prop as fn(uint, uint) -> TestResult);
}
diff --git a/e... | 8 | 69 | 47 |
30d732046b78122d4f50bf7eb18e594497ee5f08 | Andrew Gallant | 2014-12-22T01:20:20 | QuickCheck is on crates.io, so we need to use real packages. | diff --git a/Cargo.toml b/Cargo.toml
index ca0e336..5995cb6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,6 +13,6 @@ license = "Unlicense"
[lib]
name = "quickcheck"
-[dependencies.collect]
+[dependencies]
+collect = "*"
-git = "https://github.com/Gankro/collect-rs/" | 1 | 2 | 2 |
6b9c608c880bc4738c9baffbddd378188ee35c87 | Jorge Aparicio | 2014-12-21T14:20:55 | fix: `TaskBuilder` -> `thread::Builder`, `TrieMap` is now out of tree | diff --git a/Cargo.toml b/Cargo.toml
index c21d25e..8060a6e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,3 +13,6 @@ license = "Unlicense"
[lib]
name = "quickcheck"
+[dependencies.collect]
+
+git = "https://github.com/Gankro/collect-rs/"
diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 9052eac..5a76d76 1006... | 4 | 39 | 35 |
093103e054536b2f80699f003130913d2e295abf | Andrew Gallant | 2014-12-20T17:35:48 | Fix macro syntax and some 80 col violations. | diff --git a/quickcheck_macros/src/lib.rs b/quickcheck_macros/src/lib.rs
index 7e43fc1..b5620a0 100644
--- a/quickcheck_macros/src/lib.rs
+++ b/quickcheck_macros/src/lib.rs
@@ -57,11 +57,16 @@ fn expand_meta_quickcheck(cx: &mut ExtCtxt,
// ::quickcheck::quickcheck
let check_ident = token::str_... | 3 | 37 | 26 |
b9f8332448c4e6810aeea1e0df65cdd5284f2091 | Jorge Aparicio | 2014-12-19T12:35:01 | fix: adapt to changes in macro parsing | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 17a612d..a4e59af 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -171,7 +171,7 @@ impl<A: Arbitrary, B: Arbitrary> Arbitrary for Result<A, B> {
}
}
-macro_rules! impl_arb_for_tuple(
+macro_rules! impl_arb_for_tuple {
(($var_a:ident, $type_a:ide... | 2 | 17 | 17 |
d3cef00e8bdfaa7b236ddcb1f6e48881d12e3519 | Jorge Aparicio | 2014-12-15T13:57:26 | fix: `proc()` is gone, use "unboxed" closures | diff --git a/examples/out_of_bounds.rs b/examples/out_of_bounds.rs
index 3c9ec4f..cf43598 100644
--- a/examples/out_of_bounds.rs
+++ b/examples/out_of_bounds.rs
@@ -9,7 +9,7 @@ fn main() {
if index < length {
TestResult::discard()
} else {
- TestResult::must_fail(proc() {
+ ... | 3 | 9 | 9 |
79185c854a88b08c12dc2c64ec4c868f7a59c450 | Andrew Gallant | 2014-12-05T23:22:35 | Remove unused attribute. | diff --git a/quickcheck_macros/src/lib.rs b/quickcheck_macros/src/lib.rs
index d2362ac..7e43fc1 100644
--- a/quickcheck_macros/src/lib.rs
+++ b/quickcheck_macros/src/lib.rs
@@ -3,7 +3,6 @@
#![crate_name = "quickcheck_macros"]
#![crate_type = "dylib"]
-#![license = "MIT/ASL2"]
#![doc(html_root_url = "http://burntsu... | 1 | 0 | 1 |
47dcfb9dd87a38e1ef64f5280e112df31bf62564 | Andrew Gallant | 2014-12-05T23:17:58 | Fix tests.
It looks like inference got a little weaker in some cases because
of the changes to PartialEq. | diff --git a/src/tester.rs b/src/tester.rs
index c522851..689c338 100644
--- a/src/tester.rs
+++ b/src/tester.rs
@@ -105,8 +105,8 @@ impl<G: Gen> QuickCheck<G> {
///
/// fn prop_reverse_reverse() {
/// fn revrev(xs: Vec<uint>) -> bool {
- /// let rev: Vec<uint> = xs.clone().into_iter().rev... | 2 | 7 | 7 |
ea98586d53eea8a3dc05f706b7d60a5268577329 | Andrew Gallant | 2014-12-02T16:37:03 | Remove unused/unnecessary attributes. | diff --git a/src/lib.rs b/src/lib.rs
index 3d9be25..06b70eb 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,6 +1,4 @@
#![crate_name = "quickcheck"]
-#![crate_type = "lib"]
-#![license = "UNLICENSE"]
#![doc(html_root_url = "http://burntsushi.net/rustdoc/quickcheck")]
#![experimental] | 1 | 0 | 2 |
1e6e246bb2174519c936d882001feeaf9c1f3ad2 | Andrew Gallant | 2014-12-02T02:45:54 | Update bitrotten pr #10. | diff --git a/examples/sort.rs b/examples/sort.rs
index 240dc07..b5615e8 100644
--- a/examples/sort.rs
+++ b/examples/sort.rs
@@ -21,9 +21,10 @@ fn sortk<T: Clone + Ord>(x: &T, xs: &[T]) -> Vec<T> {
}
fn sort<T: Clone + Ord>(list: &[T]) -> Vec<T> {
- match list {
- [] => vec!(),
- [ref x, ..xs] => s... | 1 | 4 | 3 |
7c3ffbdacdd1cc3ff80f846ca24e8c9b99b95206 | Andrew Gallant | 2014-12-02T02:45:46 | trailing whitespace | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index ed90719..8611b16 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -95,10 +95,10 @@ pub fn single_shrinker<A: 'static>(value: A) -> Box<Shrinker<A>+'static> {
/// `Arbitrary` describes types whose values can be randomly generated and
/// shrunk.
///
-/// A... | 1 | 2 | 2 |
663fed326a3002829b4987a143a11f872826ba10 | Eduard Bopp | 2014-11-29T14:07:43 | Implement Arbitrary for n-tuples up to n=12
The macro allows us to do this now. Tuples larger than n=12 are not possible as
Rust does not implement Clone for these. | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index ef714a9..ed90719 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -174,7 +174,7 @@ impl<A: Arbitrary, B: Arbitrary> Arbitrary for Result<A, B> {
macro_rules! impl_arb_for_tuple(
(($var_a:ident, $type_a:ident) $(, ($var_n:ident, $type_n:ident))*) => (
... | 1 | 15 | 2 |
7c930012d9aedb0e5bb3fcbdc719dec980230c92 | Eduard Bopp | 2014-11-29T13:58:46 | Use a macro to implement Arbitrary for tuples
The macro is recursive in the sense that the implementation for n-tuples
(for n > 1) refers to the implementation for the (n-1)-tuple. Using a macro for
this purpose allows to instantiate the implementation for larger tuples with
much less boilerplate than before. | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 8388719..ef714a9 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -171,73 +171,42 @@ impl<A: Arbitrary, B: Arbitrary> Arbitrary for Result<A, B> {
}
}
-impl<A: Arbitrary, B: Arbitrary> Arbitrary for (A, B) {
- fn arbitrary<G: Gen>(g: &mut G) -> (A... | 1 | 33 | 64 |
7eabf9014da13f4a5ab262830c88cfa5a0695417 | Eduard Bopp | 2014-11-29T13:33:19 | Restructure Arbitrary impls for 3- and 4-tuples
The implementations of the Arbitrary trait for 3- and 4-tuples have been
restructured. The shrink method now calls its corresponding implementation on
the first element and the tail, i.e. the smaller tuple created by cutting off
the first element. With variadic generics ... | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index e7e6512..8388719 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -206,19 +206,18 @@ impl<A: Arbitrary, B: Arbitrary, C: Arbitrary> Arbitrary for (A, B, C) {
fn shrink(&self) -> Box<Shrinker<(A, B, C)>+'static> {
let (ref a, ref b, ref c) = *... | 1 | 15 | 29 |
743c44f41dcbff55555fd50bf25ba5d153a87afa | Andrew Gallant | 2014-11-21T00:21:42 | crates.io support | diff --git a/Cargo.toml b/Cargo.toml
index ce4fe7d..2f88cb6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,9 +2,14 @@
name = "quickcheck"
version = "0.1.2"
authors = ["Andrew Gallant <jamslam@gmail.com>"]
+description = "Automatic property based testing with shrinking."
+documentation = "http://burntsushi.net/rustdo... | 4 | 15 | 2 |
b07530072a2795b5c3b869151e51319824d5c207 | Jorge Aparicio | 2014-11-18T15:53:36 | Fix: enums are now namespaced
See rust-lang/rust#18973 | diff --git a/src/tester.rs b/src/tester.rs
index 0873182..c522851 100644
--- a/src/tester.rs
+++ b/src/tester.rs
@@ -6,6 +6,7 @@ use std::rand;
use std::task::TaskBuilder;
use super::{Arbitrary, Gen, Shrinker, StdGen};
use tester::trap::safe;
+use tester::Status::{Discard, Fail, Pass};
/// The main QuickCheck typ... | 1 | 1 | 0 |
ea73686113d16ddc5bbbf4d96c1ef2e2ff6f8f81 | Jorge Aparicio | 2014-11-17T14:45:23 | fix macro: `TyNil` has been removed, use zero-length `TyTup` | diff --git a/quickcheck_macros/src/lib.rs b/quickcheck_macros/src/lib.rs
index af562c1..d2362ac 100644
--- a/quickcheck_macros/src/lib.rs
+++ b/quickcheck_macros/src/lib.rs
@@ -64,7 +64,12 @@ fn expand_meta_quickcheck(cx: &mut ExtCtxt,
let inner_ident = cx.expr_ident(span, prop.ident);
let che... | 1 | 6 | 1 |
63bd8a67e37c0722336b2273b2cd71b236d3d3bf | Jorge Aparicio | 2014-11-14T13:40:26 | Fix `is_zero()`/`num::zero()` deprecation warnings | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 7a314e0..e7e6512 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -1,6 +1,6 @@
use std::collections::TrieMap;
use std::mem;
-use std::num::{Primitive, SignedInt, UnsignedInt, mod};
+use std::num::{Int, Primitive, SignedInt, UnsignedInt, mod};
use std::ran... | 1 | 6 | 6 |
da881523f17941254c30be627299185245b31059 | Jorge Aparicio | 2014-11-14T13:38:03 | Fix fallout of numeric reform | diff --git a/examples/sieve.rs b/examples/sieve.rs
index 386f3c6..10e0909 100644
--- a/examples/sieve.rs
+++ b/examples/sieve.rs
@@ -1,7 +1,8 @@
extern crate quickcheck;
-use std::iter;
use quickcheck::quickcheck;
+use std::iter;
+use std::num::Float;
fn sieve(n: uint) -> Vec<uint> {
if n <= 1 {
diff --git ... | 3 | 8 | 6 |
9b9c39f492782591e876e5547d173009d714cace | Andrew Gallant | 2014-11-08T04:52:12 | Mark the crate as experimental. | diff --git a/src/lib.rs b/src/lib.rs
index 0a670a9..3d9be25 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -2,6 +2,7 @@
#![crate_type = "lib"]
#![license = "UNLICENSE"]
#![doc(html_root_url = "http://burntsushi.net/rustdoc/quickcheck")]
+#![experimental]
//! This crate is a port of
//! [Haskell's QuickCheck](http:/... | 1 | 1 | 0 |
c0cca94895caebe586a25c37bf43a36797c7e9db | Andrew Gallant | 2014-11-08T04:52:03 | Expose a method to set the RNG. | diff --git a/src/tester.rs b/src/tester.rs
index 8ebeea7..0873182 100644
--- a/src/tester.rs
+++ b/src/tester.rs
@@ -55,6 +55,12 @@ impl<G: Gen> QuickCheck<G> {
self
}
+ /// Set the random number generator to be used by QuickCheck.
+ pub fn gen(mut self, gen: G) -> QuickCheck<G> {
+ self.ge... | 1 | 6 | 0 |
908d1ecbcfd0a35ee553d7f3c47d04969fa0a301 | Andrew Gallant | 2014-11-08T04:51:49 | Doc typos. | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 2397d4c..ae8464a 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -25,7 +25,7 @@ pub struct StdGen<R> {
/// generator.
///
/// The `size` parameter controls the size of random values generated.
-/// For example, it specifies the maximum length of a random... | 1 | 3 | 3 |
815ae0bca28b7188b1515ccab161431306f3ff53 | Andrew Gallant | 2014-11-08T03:50:52 | Fix quickcheck_macros dependencies.
The standard `quickcheck` crate no longer depends on `quickcheck_macros`.
This is partially in preparation for the impending Rust 1.0 stable
release, which will disable syntax extensions.
To use quickcheck_macros, explicitly specify it in your Cargo.toml:
[dependencies.quickch... | diff --git a/Cargo.toml b/Cargo.toml
index 4778dd3..ce4fe7d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,5 +6,5 @@ authors = ["Andrew Gallant <jamslam@gmail.com>"]
[lib]
name = "quickcheck"
-[dependencies.quickcheck_macros]
+[dev-dependencies.quickcheck_macros]
path = "quickcheck_macros"
diff --git a/quickcheck_... | 2 | 4 | 1 |
8d7cb3879953e352ad634e235ff8cf115a99dad8 | Andrew Gallant | 2014-11-08T03:47:28 | More code cleanup.
It looks like rustc has gotten better at inferred to the type of
trait objects.
Also, use a macro to implement `Fun` to reduce churn when adding
support for functions of higher arity. | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 789a2f5..b7b216e 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -74,8 +74,7 @@ impl<A> Iterator<A> for EmptyShrinker<A> {
/// Creates a shrinker with zero elements.
pub fn empty_shrinker<A>() -> Box<Shrinker<A>+'static> {
- let zero: EmptyShrinker<A... | 4 | 584 | 586 |
11ddc27ea77035d05d1c03faddd812d41544c246 | Andrew Gallant | 2014-11-08T03:46:35 | Remove Cargo.lock from quickcheck_macros. | diff --git a/quickcheck_macros/Cargo.lock b/quickcheck_macros/Cargo.lock
deleted file mode 100644
index e39e93e..0000000
--- a/quickcheck_macros/Cargo.lock
+++ /dev/null
@@ -1,4 +0,0 @@
-[root]
-name = "quickcheck_macros"
-version = "0.1.0"
- | 1 | 0 | 4 |
9935fcc0abad52be30653b3547b66e694f2a23c2 | Andrew Gallant | 2014-11-08T01:30:41 | Some touchups. | diff --git a/src/lib.rs b/src/lib.rs
index 4a5a994..a741fe4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,6 +1,3 @@
-// I have no idea what I'm doing with these attributes. Are we using
-// semantic versioning? Some packages include their full github URL.
-// Documentation for this stuff is extremely scarce.
#![crate... | 2 | 7 | 7 |
3eb99eb0f4273e86c8e6eb679a4cdb0d12508dee | David Stygstra | 2014-10-15T23:18:50 | Make functions with 4 parameters testable | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index e7af100..789a2f5 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -221,6 +221,34 @@ impl<A: Arbitrary, B: Arbitrary, C: Arbitrary> Arbitrary for (A, B, C) {
}
}
+impl<A: Arbitrary, B: Arbitrary, C: Arbitrary, D: Arbitrary> Arbitrary for (A, B, C, D) ... | 2 | 85 | 27 |
8ed37e54c445e8de2d1cb4da6f59caa8dd70705c | Andrew Gallant | 2014-11-01T01:37:30 | Fix warnings. | diff --git a/examples/sieve.rs b/examples/sieve.rs
index 8e0b24c..34c6ee4 100644
--- a/examples/sieve.rs
+++ b/examples/sieve.rs
@@ -9,12 +9,12 @@ fn sieve(n: uint) -> Vec<uint> {
}
let mut marked = Vec::from_fn(n+1, |_| false);
- *marked.get_mut(0) = true;
- *marked.get_mut(1) = true;
- *marked.ge... | 4 | 10 | 10 |
77f866dd9f0d115355966518ca4c6f9884b03257 | Darin Morrison | 2014-10-30T20:52:55 | Rename fail! to panic! to fix build | diff --git a/src/lib.rs b/src/lib.rs
index e84df0d..348b2e8 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -65,7 +65,7 @@ mod tester {
/// }
/// ```
///
- /// In particular, `quickcheck` will call `fail!` if it finds a
+ /// In particular, `quickcheck` will call `panic!` if it finds a
/// test fa... | 1 | 3 | 3 |
328770023126c17a485dd013e537c8c34289ee2d | Andrew Gallant | 2014-10-09T01:25:11 | Make quickcheck work again.
For the fix: https://github.com/rust-lang/rust/issues/17878 | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index f3a039d..d3888dd 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -59,7 +59,7 @@ pub trait Shrinker<A> {
}
impl<A> Iterator<A> for Box<Shrinker<A>+'static> {
- fn next(&mut self) -> Option<A> { self.next_shrink() }
+ fn next(&mut self) -> Option<A>... | 2 | 4 | 4 |
a7b2b41281f21cc4902049bfefdeb7da7c8b72fa | Andrew Gallant | 2014-10-09T01:11:28 | Fix some tests. | diff --git a/tests/macro.rs b/tests/macro.rs
index 3170ae4..816af09 100644
--- a/tests/macro.rs
+++ b/tests/macro.rs
@@ -1,3 +1,4 @@
+#![allow(non_uppercase_statics)]
#![feature(phase)]
#[phase(plugin)]
@@ -15,9 +16,9 @@ fn min(x: int, y: int) -> TestResult {
}
}
-#[quickcheck]
-#[should_fail]
-fn fail_fn()... | 1 | 4 | 3 |
41cca0ec8124b61ab47573140b7040b799454c24 | Jorge Aparicio | 2014-10-03T15:11:59 | `managed_boxes` feature gate (an Gc) has been removed from the language | diff --git a/quickcheck_macros/src/lib.rs b/quickcheck_macros/src/lib.rs
index 60bcd5f..af562c1 100644
--- a/quickcheck_macros/src/lib.rs
+++ b/quickcheck_macros/src/lib.rs
@@ -6,7 +6,7 @@
#![license = "MIT/ASL2"]
#![doc(html_root_url = "http://burntsushi.net/rustdoc/quickcheck")]
-#![feature(plugin_registrar, mana... | 1 | 1 | 1 |
afdefbf62c10072555551cc3a2fb84f6cfed0a62 | Andrew Gallant | 2014-09-27T14:47:39 | Updates for Rust master.
(Fixed all the warnings.) | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index dc9fc14..f3a039d 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -239,7 +239,7 @@ impl<A: Arbitrary> Arbitrary for Vec<A> {
// any of the elements.
let mut k = self.len() / 2;
while k > 0 {
- xs.push_all_move(shuffle_ve... | 2 | 21 | 20 |
faa2d45d7e615355a46e2b3c3639c14f1a353e38 | Jorge Aparicio | 2014-09-21T16:34:40 | Fix: `ItemModifier` variant has been renamed to `Modifier` | diff --git a/quickcheck_macros/src/lib.rs b/quickcheck_macros/src/lib.rs
index a7a95f4..60bcd5f 100644
--- a/quickcheck_macros/src/lib.rs
+++ b/quickcheck_macros/src/lib.rs
@@ -14,7 +14,7 @@ extern crate rustc;
use syntax::ast;
use syntax::codemap;
use syntax::parse::token;
-use syntax::ext::base::{ExtCtxt, ItemModi... | 1 | 2 | 2 |
8c2f643a3a8f66e36a05318cd79fbb54b3c35d7b | Andrew Gallant | 2014-09-15T15:41:25 | More changes to bring up to date with master. | diff --git a/quickcheck_macros/src/lib.rs b/quickcheck_macros/src/lib.rs
index dced269..a7a95f4 100644
--- a/quickcheck_macros/src/lib.rs
+++ b/quickcheck_macros/src/lib.rs
@@ -11,13 +11,12 @@
extern crate syntax;
extern crate rustc;
-use std::gc::{GC, Gc};
-
use syntax::ast;
use syntax::codemap;
use syntax::par... | 1 | 7 | 8 |
2328a0ffc6bf1bb430c06a7033cbe2fbdc5952a7 | Matt Windsor | 2014-09-14T20:52:12 | Box `expand_meta_quickcheck`.
Recent changes to the rust AST mean that ItemModifier takes a trait implementation, and thus `expand_meta_quickcheck` needs to be boxed. | diff --git a/quickcheck_macros/src/lib.rs b/quickcheck_macros/src/lib.rs
index 3c58c40..dced269 100644
--- a/quickcheck_macros/src/lib.rs
+++ b/quickcheck_macros/src/lib.rs
@@ -26,7 +26,7 @@ use rustc::plugin::Registry;
#[doc(hidden)]
pub fn plugin_registrar(reg: &mut Registry) {
reg.register_syntax_extension(to... | 1 | 1 | 1 |
cab67a1a2ebdd39b90d32f177d88b2691fcb9aa4 | Jorge Aparicio | 2014-09-01T15:48:45 | Add TestResult::must_fail
Closes #18 | diff --git a/examples/out_of_bounds.rs b/examples/out_of_bounds.rs
new file mode 100644
index 0000000..3c9ec4f
--- /dev/null
+++ b/examples/out_of_bounds.rs
@@ -0,0 +1,18 @@
+extern crate quickcheck;
+
+use quickcheck::{TestResult, quickcheck};
+
+fn main() {
+ fn prop(length: uint, index: uint) -> TestResult {
+ ... | 2 | 38 | 0 |
b122316d32b19701dfebe57119c44cf1a9f76b8c | Andrew Gallant | 2014-08-31T01:01:02 | Fixes #20.
I moved tests that depend on both `quickcheck` and `quickcheck_macros`
into the `tests` subdirectory, which Cargo seems to like. | diff --git a/Cargo.toml b/Cargo.toml
index c78fb74..44eb94b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,4 +7,4 @@ authors = ["Andrew Gallant <jamslam@gmail.com>"]
name = "quickcheck"
[dependencies.quickcheck_macros]
-path = "quickcheck_macros/"
+path = "quickcheck_macros"
diff --git a/src/lib.rs b/src/lib.rs
ind... | 3 | 35 | 37 |
7ce8ba135b9800a38e54585523257b747a2cc52c | Andrew Gallant | 2014-08-30T15:34:15 | Update for latest Rust. | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 67d8dae..dc9fc14 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -263,9 +263,13 @@ impl<A: Arbitrary> Arbitrary for TrieMap<A> {
vec.move_iter().collect()
}
- fn shrink(&self) -> Box<Shrinker<TrieMap<A>>> {
- let vec: Vec<(uint, A)... | 1 | 7 | 3 |
ae5af3a62a3b30566f3c95f969d330a2610bd976 | Andrew Gallant | 2014-08-02T01:56:46 | unshift -> insert and get() -> [] | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 35d6f5c..fd6dd26 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -355,7 +355,7 @@ fn shuffle_vec<A: Clone>(xs: &[A], k: uint) -> Vec<Vec<A>> {
};
let shuffled = shuffle(xs2.as_slice(), k, n-k);
let mut more: Vec<Vec<A>> = shuffled... | 2 | 3 | 3 |
57ea48ce10d9e51806cef2ea0ca88be4e6f7a89b | Alex Crichton | 2014-07-13T05:13:11 | Update Cargo.toml to the new `plugin = true` flag | diff --git a/quickcheck_macros/Cargo.toml b/quickcheck_macros/Cargo.toml
index dbaeea6..7bd53ef 100644
--- a/quickcheck_macros/Cargo.toml
+++ b/quickcheck_macros/Cargo.toml
@@ -6,4 +6,4 @@ authors = ["Andrew Gallant <jamslam@gmail.com>"]
[[lib]]
name = "quickcheck_macros"
path = "src/lib.rs"
-crate_type = ["dylib"]
... | 1 | 1 | 1 |
92f30bb9cec042a09f608fa0474d33a8699143f5 | Arjan Topolovec | 2014-07-10T13:44:02 | Str to string renaming and replaced deprecated crate_id with craate_name | diff --git a/quickcheck_macros/src/lib.rs b/quickcheck_macros/src/lib.rs
index 4c89756..3c58c40 100644
--- a/quickcheck_macros/src/lib.rs
+++ b/quickcheck_macros/src/lib.rs
@@ -1,7 +1,7 @@
//! This crate provides the `#[quickcheck]` attribute. Its use is
//! documented in the `quickcheck` crate.
-#![crate_id = "qui... | 2 | 6 | 6 |
68cafb3f80c7633750bb125aa5b7b0fd31a9c7c6 | Andrew Gallant | 2014-06-27T00:19:29 | Update for latest Rust. Annotate numbers with types. | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 8d81d67..5bacd17 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -410,7 +410,7 @@ fn shuffle_vec<A: Clone>(xs: &[A], k: uint) -> Vec<Vec<A>> {
shuffle(xs, k, xs.len())
}
-fn half<A: Primitive>(x: A) -> A { x / num::cast(2).unwrap() }
+fn half<A: Pri... | 1 | 5 | 5 |
b4fdfdace904b06ff0db399ec77ab60253a78e4a | Huon Wilson | 2014-06-25T08:00:11 | Use a macro for the signed/unsigned integer Arbitrary impls. | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index b7683eb..d765a26 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -279,94 +279,40 @@ impl Arbitrary for char {
}
}
-impl Arbitrary for int {
- fn arbitrary<G: Gen>(g: &mut G) -> int {
- let s = g.size(); g.gen_range(-(s as int), s as int)
-... | 1 | 28 | 82 |
4855524eaa3be1fc07591184e94a00d4fd569c07 | Huon Wilson | 2014-06-25T07:56:21 | Override fill_bytes and next_u64 for StdGen.
Some RNGs override these for efficiency, so we might as well defer
directly to them. | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 8d81d67..b7683eb 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -32,6 +32,11 @@ pub struct StdGen<R> {
impl<R: Rng> Rng for StdGen<R> {
fn next_u32(&mut self) -> u32 { self.rng.next_u32() }
+
+ // some RNGs implement these more efficiently than ... | 1 | 5 | 0 |
9d890efcf35cc12c6d63d60e88f6e4647062183b | Andrew Gallant | 2014-06-24T00:12:25 | Update to work with latest Rust. | diff --git a/src/lib.rs b/src/lib.rs
index 21c0611..617ff23 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -395,10 +395,9 @@ mod tester {
let mut reader = ChanReader::new(recv);
let mut t = TaskBuilder::new();
- t.opts.name = Some(("safefn".to_string()).into_maybe_owned());
- ... | 1 | 3 | 4 |
1285cf8a52f3acf9cbf3fcb55e09bb4703d8da64 | Andrew Gallant | 2014-06-16T03:01:01 | collections -> std::collections | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 6051282..8d81d67 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -484,7 +484,7 @@ mod test {
use std::fmt::Show;
use std::hash::Hash;
use std::iter;
- use collections::HashSet;
+ use std::collections::HashSet;
use std::rand;
u... | 1 | 1 | 1 |
80cca3bdbec5dc1779de7824f8e9b1753bc67726 | Andrew Gallant | 2014-06-16T02:58:22 | Remove final ~str vestige. | diff --git a/src/lib.rs b/src/lib.rs
index 90c53d7..21c0611 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -15,7 +15,7 @@
#![feature(phase)]
extern crate collections;
-#[phase(syntax, link)] extern crate log;
+#[phase(plugin, link)] extern crate log;
pub use arbitrary::{Arbitrary, Gen, StdGen, Shrinker, gen, empty_... | 1 | 2 | 2 |
10b115abf61738e99924e09694024e4b99b086c6 | Andrew Gallant | 2014-06-04T01:50:28 | Update for changes in Rust libraries.
to_owned/to_strbuf -> to_string
Total{Eq,Ord} -> {Eq,Ord}
rand -> std::rand
Rng::gen_ascii_str -> Rng::gen_ascii_chars | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 93c7484..6051282 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -1,6 +1,6 @@
use std::mem;
use std::num;
-use rand::Rng;
+use std::rand::Rng;
/// Returns a `Gen` with the given configuration using any random number
/// generator.
@@ -254,7 +254,7 @@ ... | 2 | 21 | 22 |
ad9715e44c7bf3167528be12cc483f85112ed9dc | Dan Burkert | 2014-05-29T05:00:26 | update string conversions | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 93c7484..cbef685 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -254,7 +254,7 @@ impl<A: Arbitrary> Arbitrary for Vec<A> {
impl Arbitrary for String {
fn arbitrary<G: Gen>(g: &mut G) -> String {
let size = { let s = g.size(); g.gen_range(0, ... | 2 | 12 | 12 |
4d04e5123fc8ade219b3d0e11281d7e45bdbc255 | Andrew Gallant | 2014-05-26T18:16:55 | StrBuf -> String | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 3bbbcf1..93c7484 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -251,17 +251,17 @@ impl<A: Arbitrary> Arbitrary for Vec<A> {
}
}
-impl Arbitrary for StrBuf {
- fn arbitrary<G: Gen>(g: &mut G) -> StrBuf {
+impl Arbitrary for String {
+ fn arbi... | 2 | 10 | 10 |
e1a03e493d0a71957f81a993e02541362993913b | Andrew Gallant | 2014-05-25T17:33:36 | ~str -> StrBuf | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index bce5d0e..3bbbcf1 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -251,20 +251,6 @@ impl<A: Arbitrary> Arbitrary for Vec<A> {
}
}
-impl Arbitrary for ~str {
- fn arbitrary<G: Gen>(g: &mut G) -> ~str {
- let size = { let s = g.size(); g.gen_... | 2 | 7 | 21 |
f3b2ce6610cba0ba5d19a6a2bacd87d97f6b595e | Andrew Gallant | 2014-05-18T15:49:11 | Add StrBuf impl and fix the ~str impl. | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 58cc236..bce5d0e 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -1,6 +1,5 @@
use std::mem;
use std::num;
-use std::str;
use rand::Rng;
/// Returns a `Gen` with the given configuration using any random number
@@ -255,17 +254,28 @@ impl<A: Arbitrary> A... | 1 | 18 | 8 |
2cb049e71ceb8d0d5b6cbfc2304e7a7dfc10d9a2 | moonglum | 2014-05-10T21:46:17 | Example for a buggy QuickSort implementation | diff --git a/examples/sort.rs b/examples/sort.rs
new file mode 100644
index 0000000..240dc07
--- /dev/null
+++ b/examples/sort.rs
@@ -0,0 +1,46 @@
+// This is a buggy quick sort implementation, QuickCheck will find the bug for you
+
+extern crate quickcheck;
+
+use quickcheck::quickcheck;
+
+fn smaller_than<T: Clone + ... | 1 | 46 | 0 |
b5312cf8817744cb3ed036365ae740e0168a60d9 | Andrew Gallant | 2014-05-11T01:02:19 | Use a trait for abstracting over function calls. | diff --git a/src/lib.rs b/src/lib.rs
index aa7bb76..f60dc6c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -244,76 +244,92 @@ mod tester {
impl<T: Testable> Testable for fn() -> T {
fn result<G: Gen>(&self, g: &mut G) -> TestResult {
- shrink(g, Zero::<(), (), (), T>(*self))
+ shrink:... | 1 | 62 | 46 |
e93ca4b50362dc13a4c707796c188af86ef94993 | Brendan Zabarauskas | 2014-05-10T23:45:38 | Implement lazy shrinking for numbers
Floating point shrinking is a little ugly at the moment because it goes through two layers of `Box<Shrinker<A>>`s.
Thanks to @alan_andrade for his help on this one.
Closes #3. | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index eb38aaa..58cc236 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -283,7 +283,7 @@ impl Arbitrary for int {
let s = g.size(); g.gen_range(-(s as int), s as int)
}
fn shrink(&self) -> Box<Shrinker<int>> {
- box shrink_signed(*self).m... | 1 | 73 | 40 |
51a6b18381259e0bb5020e8d87e1b35dadb22cd4 | moonglum | 2014-05-10T20:55:55 | Better name for the property | diff --git a/examples/reverse.rs b/examples/reverse.rs
index 56fa618..cb9d122 100644
--- a/examples/reverse.rs
+++ b/examples/reverse.rs
@@ -11,8 +11,8 @@ fn reverse<T: Clone>(xs: &[T]) -> Vec<T> {
}
fn main() {
- fn prop(xs: Vec<int>) -> bool {
+ fn equality_after_applying_twice(xs: Vec<int>) -> bool {
... | 1 | 2 | 2 |
802f504f4773b7a94ba683122571cbb7379716df | Jonathan S | 2014-05-10T18:07:20 | Added a convenience single_shrinker function for easier shrinking
A lot of the shrinking code uses `vec!()` and `.move_iter()`, which end up being not very
readable or efficient (they use an extra allocation). This adds a function similar to
`empty_shrinker` that allows you to easily create a shrinker with a single po... | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 8161478..eb38aaa 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -1,3 +1,4 @@
+use std::mem;
use std::num;
use std::str;
use rand::Rng;
@@ -72,6 +73,20 @@ pub fn empty_shrinker<A>() -> Box<Shrinker<A>> {
box zero as Box<Shrinker<A>>
}
+struct Sin... | 2 | 21 | 8 |
c61169af9618e1730e63c490ee1ba22a51bc1e09 | Andrew Gallant | 2014-05-09T15:47:05 | Switch from ~ to box | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 3409b49..8161478 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -52,7 +52,7 @@ pub trait Shrinker<A> {
fn next_shrink(&mut self) -> Option<A>;
}
-impl<A> Iterator<A> for ~Shrinker<A> {
+impl<A> Iterator<A> for Box<Shrinker<A>> {
fn next(&mut s... | 2 | 55 | 55 |
277867f419c81166a729a816e7570eccd058e5fd | Andrew Gallant | 2014-05-09T15:23:04 | Expose a convenience 'empty_shrinker' function. | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 8e74f57..3409b49 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -66,7 +66,8 @@ impl<A> Iterator<A> for EmptyShrinker<A> {
fn next(&mut self) -> Option<A> { None }
}
-fn empty_shrinker<A>() -> ~Shrinker<A> {
+/// Creates a shrinker with zero element... | 2 | 3 | 2 |
ca9ad3730f84c8b7bf2383b65b4186ffdf0e7dbb | Andrew Gallant | 2014-05-09T00:11:16 | some touchups | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index d9f0999..8e74f57 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -85,7 +85,7 @@ fn empty_shrinker<A>() -> ~Shrinker<A> {
pub trait Arbitrary : Clone + Send {
fn arbitrary<G: Gen>(g: &mut G) -> Self;
fn shrink(&self) -> ~Shrinker<Self> {
- ... | 2 | 5 | 5 |
2c0f625229d194cb6441e5b4b6df627597815b0f | Andrew Gallant | 2014-05-08T18:51:59 | Some code cleanup and comments. | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 1f07554..d9f0999 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -1,5 +1,5 @@
-use std::num::{one, zero};
-use std::str::from_chars;
+use std::num;
+use std::str;
use rand::Rng;
/// Returns a `Gen` with the given configuration using any random number
@@... | 2 | 131 | 139 |
8bd7199912b601f073b821fcc516bed1ae66d8f2 | Jonathan S | 2014-05-04T16:49:00 | Switched from the old ~"str" syntax to using .to_owned() | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index d1d4af4..1f07554 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -605,9 +605,12 @@ mod test {
#[test]
fn strs() {
- eq(~"", vec!());
- eq(~"A", vec!(~""));
- eq(~"ABC", vec!(~"", ~"AB", ~"BC", ~"AC"));
+ eq("".to_owne... | 2 | 9 | 6 |
264e7e1b47d6cd185ac1210b2baca1ddbb2987a4 | Andrew Gallant | 2014-04-25T21:04:05 | Update to use TaskBuilder instead of task function. | diff --git a/src/lib.rs b/src/lib.rs
index 3cc68fc..672c6e3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -365,7 +365,7 @@ mod tester {
mod trap {
use std::comm::channel;
use std::io::{ChanReader, ChanWriter};
- use std::task::task;
+ use std::task::TaskBuilder;
// This is ... | 1 | 2 | 2 |
0b33956cb7c5d391931dc5536e51f6d74c4d4282 | Andrew Gallant | 2014-04-21T20:27:54 | No more priv needed. | diff --git a/src/lib.rs b/src/lib.rs
index 8cc4e00..3cc68fc 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -137,7 +137,7 @@ mod tester {
/// Whether a test has passed, failed or been discarded.
#[deriving(Clone, Show)]
- priv enum Status { Pass, Fail, Discard }
+ enum Status { Pass, Fail, Discard }
... | 1 | 1 | 1 |
55b3e2c9469743543314fc849104814fe69d3671 | Andrew Gallant | 2014-04-10T19:11:54 | Update for new proc region param syntax. | diff --git a/src/lib.rs b/src/lib.rs
index ae2a670..8cc4e00 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -380,7 +380,7 @@ mod tester {
//
// Moreover, this feature seems to prevent an implementation of
// Testable for a stack closure type. *sigh*
- pub fn safe<T: Send>(fun: proc:Send() ... | 1 | 1 | 1 |
ed5d20539f9baa94d997fcf46eb05b6e98702611 | Andrew Gallant | 2014-04-01T18:51:56 | Update to use new visibility defaults. | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 4fbb6cd..d1d4af4 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -26,8 +26,8 @@ pub trait Gen : Rng {
/// Values of type `StdGen` can be created with the `gen` function in this
/// crate.
pub struct StdGen<R> {
- priv rng: R,
- priv size: uint,
+ ... | 2 | 10 | 10 |
97344611c1e46b92ba37602ea5281dc028155832 | Andrew Gallant | 2014-03-30T23:38:21 | Renamed ObjIter to Iter.
Fixes for changes in Rust tip. | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 7f49ae4..4fbb6cd 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -38,25 +38,25 @@ impl<R: Rng> Gen for StdGen<R> {
fn size(&self) -> uint { self.size }
}
-/// `~ObjIter` is an existential type that represents an arbitrary iterator
+/// `~Iter` is an... | 2 | 69 | 69 |
f8260167aabf77268f252e73ce9c9b98b148f72f | Andrew Gallant | 2014-03-24T17:43:51 | Get rid of last remnants of to_owned_vec. | diff --git a/src/lib.rs b/src/lib.rs
index 77901b6..363df74 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -56,8 +56,8 @@ mod tester {
/// ```rust
/// fn prop_reverse_reverse() {
/// fn revrev(xs: Vec<uint>) -> bool {
- /// let rev = xs.clone().move_iter().rev().to_owned_vec();
- /// ... | 1 | 2 | 2 |
fd0360aeba3279851297d2940e521d1631c11a1a | Andrew Gallant | 2014-03-24T17:43:39 | Something is screwy with the Eq and TotalEq traits. | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index d9372e3..7f49ae4 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -571,19 +571,19 @@ mod test {
eq(0u64, vec!());
}
- #[test]
- fn floats32() {
- ordered_eq(5f32, vec!(0f32, 3f32, 4f32));
- ordered_eq(-5f32, vec!(0f32, 5f3... | 1 | 21 | 19 |
2593d048d581f84548805ca0ab2bf9acf9584304 | Andrew Gallant | 2014-03-17T17:12:19 | Use the log crate for debug macro. | diff --git a/src/lib.rs b/src/lib.rs
index 9e965f9..0fb0cd5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -13,7 +13,11 @@
//! For detailed examples, please see the
//! [README](https://github.com/BurntSushi/quickcheck).
+// Dunno what this is, but apparently it's required for the 'log' crate.
+#[feature(phase)];
+
e... | 1 | 4 | 0 |
27d89ad8ae47efb27626c2891fc7c1221506077b | Andrew Gallant | 2014-03-16T19:46:10 | Ignore ~[] deprecation for now. Started work on converting in vecng branch. | diff --git a/src/lib.rs b/src/lib.rs
index b8a50f4..9e965f9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -5,6 +5,7 @@
#[crate_type = "lib"];
#[license = "UNLICENSE"];
#[doc(html_root_url = "http://burntsushi.net/rustdoc/quickcheck")];
+#[allow(deprecated_owned_vector)];
//! This crate is a port of
//! [Haskell's ... | 1 | 1 | 0 |
76f384f20f5e08de9455e04b85c3da66981afc99 | Andrew Gallant | 2014-03-16T19:44:44 | Started work on moving to vec_ng.
There are still some warnings left. And I think I'm doing more
allocations now... | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 5c75307..9cec475 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -1,6 +1,6 @@
use std::num::{one, zero};
use std::str::from_chars;
-use std::vec;
+use std::vec_ng::Vec;
use rand::Rng;
/// Returns a `Gen` with the given configuration using any random n... | 2 | 137 | 126 |
931a3af491b93586a86b5f38ca37acba7acbae31 | Andrew Gallant | 2014-03-16T04:36:20 | Fixed bug where the Option<T> was being added as an argument instead of just the T. | diff --git a/src/lib.rs b/src/lib.rs
index 01ec1be..b8a50f4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -278,7 +278,8 @@ mod tester {
match self {
Zero(f) => safe(proc() { f() }).result(g),
One(f) => {
- let oa = ~a.unwrap().clone();
+ ... | 1 | 6 | 4 |
6abbb113438c60bc147330f485882c423d1809b6 | Andrew Gallant | 2014-03-14T18:22:27 | Provided a default implementation for shrink. | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 298690b..5c75307 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -71,7 +71,9 @@ impl<T, A: Iterator<T>> ObjIter<T> for A {
/// `Clone`. (I'm not sure if this is a permanent restriction.)
pub trait Arbitrary : Clone + Send {
fn arbitrary<G: Gen>(g: &m... | 1 | 3 | 1 |
8d254aa9eb91f84068dfc04aff7bf50fc5d32cbc | Andrew Gallant | 2014-03-14T06:01:10 | Update for channel renaming. | diff --git a/src/lib.rs b/src/lib.rs
index 38bf579..01ec1be 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -357,8 +357,8 @@ mod tester {
#[cfg(not(quickfail))]
mod trap {
- use std::comm::Chan;
- use std::io::{PortReader, ChanWriter};
+ use std::comm::channel;
+ use std::io::{ChanRe... | 1 | 6 | 5 |
992b5662061ead1f13c2f7c91674cd9c69932b42 | Andrew Gallant | 2014-03-14T06:00:48 | Forgot to remove this when trying to get stack closures working. | diff --git a/src/lib.rs b/src/lib.rs
index 2995558..08d4e18 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -431,21 +431,6 @@ mod test {
}
}
- #[test]
- fn simple_closure() {
- qcheck(|| true);
- }
-
- // #[test]
- // fn prop_reverse_reverse_closure() {
- // let prop = |xs: ~[... | 1 | 0 | 15 |
2f35e31df0962b669cf43af25882fd433c047580 | Andrew Gallant | 2014-03-14T05:56:47 | Support recovery from task failures.
(rustc will do it for us, but quickcheck has to do it too so that
we can shrink appropriately.)
Sadly, it seems like this prevents stack closures from satisfying
the Testable trait. | diff --git a/src/lib.rs b/src/lib.rs
index 40275a0..2995558 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -25,9 +25,9 @@ mod arbitrary;
mod tester {
use std::fmt::Show;
use std::iter;
- use std::task;
use rand::task_rng;
use super::{Arbitrary, Gen, ObjIter, gen};
+ use tester::trap::safe;
... | 1 | 184 | 119 |
65686c6b8f25537e62967d2cf5de7d6f08cddf24 | Andrew Gallant | 2014-03-14T05:55:52 | All types that satisfy Arbitrary must now be sendable. | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index f7a95c5..298690b 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -69,7 +69,7 @@ impl<T, A: Iterator<T>> ObjIter<T> for A {
///
/// As of now, all types that implement `Arbitrary` must also implement
/// `Clone`. (I'm not sure if this is a permanent rest... | 1 | 1 | 1 |
4e4c8b4756847ab07a84cbc5c75c5d6d28205137 | Andrew Gallant | 2014-03-12T21:46:54 | formatting | diff --git a/src/lib.rs b/src/lib.rs
index 6922ea7..40275a0 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -87,7 +87,7 @@ mod tester {
/// Like `quickcheck_config`, but returns either the number of tests passed
/// or a witness of failure.
pub fn quicktest_config<A: Testable, G: Gen>
- (c: Config, g:... | 1 | 1 | 1 |
fd7a7d83a5ab2d3cf4deeec29e6115df972aa264 | Andrew Gallant | 2014-03-12T19:43:25 | get rid of commented out code | diff --git a/src/lib.rs b/src/lib.rs
index 987a63a..893a3d2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -21,7 +21,6 @@ pub use tester::{quickcheck, quickcheckConfig, quicktest, quicktestConfig};
pub use tester::{DEFAULT_CONFIG, DEFAULT_SIZE};
mod arbitrary;
-// mod shrink;
mod tester {
use std::fmt::Show; | 1 | 0 | 1 |
019d8c71490a2a0db94ea055e2b2f3ad01f6c05c | Andrew Gallant | 2014-03-12T19:33:42 | clearer doco | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 61a6fe7..f7a95c5 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -3,7 +3,8 @@ use std::str::from_chars;
use std::vec;
use rand::Rng;
-/// Returns a `Gen` with the given configuration.
+/// Returns a `Gen` with the given configuration using any random nu... | 1 | 8 | 1 |
4ffa122876b2cc927bed3e6e6a6ef513efee9ca1 | Andrew Gallant | 2014-03-12T19:05:02 | Link to the README in the crate doco. | diff --git a/src/lib.rs b/src/lib.rs
index 2828cd0..987a63a 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -8,6 +8,9 @@
//! This crate is a port of
//! [Haskell's QuickCheck](http://hackage.haskell.org/package/QuickCheck).
+//!
+//! For detailed examples, please see the
+//! [README](https://github.com/BurntSushi/quic... | 1 | 3 | 0 |
9e278c7c72e4010155a8744ce59eda58cdaf5d6d | Andrew Gallant | 2014-03-12T19:04:37 | added another example of reversing a singleton vector | diff --git a/examples/reverse_single.rs b/examples/reverse_single.rs
new file mode 100644
index 0000000..1e38bf9
--- /dev/null
+++ b/examples/reverse_single.rs
@@ -0,0 +1,21 @@
+extern crate quickcheck;
+
+use quickcheck::{TestResult, quickcheck};
+
+fn reverse<T: Clone>(xs: &[T]) -> ~[T] {
+ let mut rev = ~[];
+ ... | 1 | 21 | 0 |
343ba8124aedad4e04febe96f3b058c6fefb70d5 | Andrew Gallant | 2014-03-12T07:12:02 | Update to work with relocation of rand crate. | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index a05dfa6..61a6fe7 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -1,7 +1,7 @@
use std::num::{one, zero};
-use std::rand::Rng;
use std::str::from_chars;
use std::vec;
+use rand::Rng;
/// Returns a `Gen` with the given configuration.
///
@@ -417,8 +417... | 2 | 5 | 4 |
5c68f4d3a3b4c0fd2b3e5bbd9e2f02896989cdee | Andrew Gallant | 2014-03-12T07:09:45 | The sieve test should fail. | diff --git a/src/lib.rs b/src/lib.rs
index 05ac4ab..a732c69 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -444,7 +444,7 @@ mod test {
}
#[test]
- // #[should_fail]
+ #[should_fail]
fn sieve_of_eratosthenes() {
fn sieve(n: uint) -> ~[uint] {
if n <= 1 { | 1 | 1 | 1 |
c93912dae7756baa090c1742a304171541aaae0a | Andrew Gallant | 2014-03-12T07:08:33 | Add doco. Add prime number sieve test. Add attempt to catch runtime
errors. (Couldn't get it to work.) | diff --git a/src/lib.rs b/src/lib.rs
index 1088c33..05ac4ab 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -23,7 +23,8 @@ mod tester {
use std::fmt::Show;
use std::iter;
use std::rand::task_rng;
- use super::{Arbitrary, Gen, gen};
+ use std::task;
+ use super::{Arbitrary, Gen, ObjIter, gen};
... | 1 | 204 | 69 |
4870f824e2bc2a38ddceceaea7b2992ba72bb8bc | Andrew Gallant | 2014-03-12T07:07:59 | Consistent doco. | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 93a4c87..a05dfa6 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -12,7 +12,7 @@ pub fn gen<R: Rng>(rng: R, size: uint) -> StdGen<R> {
StdGen{rng: rng, size: size}
}
-/// Gen wraps a `rand::Rng` with parameters to control the distribution of
+/// `Ge... | 1 | 1 | 1 |
4898e1df537097ba447283b07ddcfb0d4b7b471f | Andrew Gallant | 2014-03-12T02:16:24 | Merged Arbitrary and Shrink traits. | diff --git a/src/arbitrary.rs b/src/arbitrary.rs
index 85415ca..93a4c87 100644
--- a/src/arbitrary.rs
+++ b/src/arbitrary.rs
@@ -1,6 +1,17 @@
+use std::num::{one, zero};
use std::rand::Rng;
+use std::str::from_chars;
use std::vec;
+/// Returns a `Gen` with the given configuration.
+///
+/// The `size` parameter con... | 3 | 461 | 512 |
dc39e8b732b9604ab4bb0611656733bc03fa041e | Andrew Gallant | 2014-03-12T02:01:07 | Basic quickcheck appears to work. | diff --git a/src/lib.rs b/src/lib.rs
index 8c4d546..f0f3b9f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -13,23 +13,97 @@ extern crate collections;
pub use arbitrary::{Arbitrary, Gen, StdGen, gen};
pub use shrink::{ObjIter, Shrink};
-pub use tester::{Testable, TestResult, Config, quickcheck, quickcheckConfig};
+pub ... | 1 | 210 | 95 |
b0ea984d5c30e0934b65151b754c123357667e52 | Andrew Gallant | 2014-03-12T02:00:48 | Make Clone a supertrait of Shrink. | diff --git a/src/shrink.rs b/src/shrink.rs
index 7dde28f..3011113 100644
--- a/src/shrink.rs
+++ b/src/shrink.rs
@@ -5,7 +5,7 @@ use std::str::from_chars;
use std::vec;
/// Implementations of the `Shrink` trait specify how values can be shrunk.
-pub trait Shrink {
+pub trait Shrink : Clone {
fn shrink(&self) -... | 1 | 4 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.