Debian Codegraph @

src/tests.rs

raw symbols SCIP
1 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::hash_maprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash_map/::DefaultHasherrust-analyzer cargo std https://github.com/rust-lang/rust/library/std hash/random/DefaultHasher#;
2 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::collectionsrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/::{HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#, HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#};
3 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::CStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/CString#;
4 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::hashrust-analyzer cargo std https://github.com/rust-lang/rust/library/std hash/::BuildHasherDefaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/BuildHasherDefault#;
5 use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#;
6
7 use superrust-analyzer cargo quickcheck 1.1.0 crate/::{quickcheckrust-analyzer cargo quickcheck 1.1.0 tester/quickcheck()., Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#, QuickCheckrust-analyzer cargo quickcheck 1.1.0 tester/QuickCheck#, TestResultrust-analyzer cargo quickcheck 1.1.0 tester/TestResult#};
8
9 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
10 fn prop_oobrust-analyzer cargo quickcheck 1.1.0 tests/prop_oob().() {
11 fn proprust-analyzer cargo quickcheck 1.1.0 tests/prop().() -> bool {
12 let zero: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<bool> = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![];
13 zero[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().
14 }
15 if let Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(n) = QuickCheckrust-analyzer cargo quickcheck 1.1.0 tester/QuickCheck#::newrust-analyzer cargo quickcheck 1.1.0 tester/impl#[QuickCheck]new().().quicktestrust-analyzer cargo quickcheck 1.1.0 tester/impl#[QuickCheck]quicktest().(proprust-analyzer cargo quickcheck 1.1.0 tests/prop(). as fn() -> bool) {
16 panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!(
17 "prop_oob should fail with a runtime error \
18 but instead it passed {} tests.",
19 n
20 );
21 }
22 }
23
24 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
25 fn prop_reverse_reverserust-analyzer cargo quickcheck 1.1.0 tests/prop_reverse_reverse().() {
26 fn proprust-analyzer cargo quickcheck 1.1.0 tests/prop().(xs: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<usize>) -> bool {
27 let rev: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = xs.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().().into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().revrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#rev().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
28 let revrev: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = rev.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().revrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#rev().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
29 xs rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Vec<T, A1>`][`PartialEq<Vec<U, A2>>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Vec<T, A1>`][`PartialEq<Vec<U, A2>>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Vec<T, A1>`][`PartialEq<Vec<U, A2>>`]eq().revrev
30 }
31 quickcheckrust-analyzer cargo quickcheck 1.1.0 tester/quickcheck().(proprust-analyzer cargo quickcheck 1.1.0 tests/prop(). as fn(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<usize>) -> bool);
32 }
33
34 quickcheckrust-analyzer cargo quickcheck 1.1.0 quickcheck!! {
35 fn prop_reverse_reverse_macrorust-analyzer cargo quickcheck 1.1.0 tests/prop_reverse_reverse_macro().(xs: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<usize>) -> bool {
36 let rev: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = xs.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().().into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().revrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#rev().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
37 let revrev: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_> = rev.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().revrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#rev().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
38 xs == revrev
39 }
40
41 #[should_panic]
42 fn prop_macro_panicrust-analyzer cargo quickcheck 1.1.0 tests/prop_macro_panic().(_x: u32) -> bool {
43 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(false);
44 false
45 }
46 }
47
48 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
49 fn reverse_singlerust-analyzer cargo quickcheck 1.1.0 tests/reverse_single().() {
50 fn proprust-analyzer cargo quickcheck 1.1.0 tests/prop().(xs: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<usize>) -> TestResultrust-analyzer cargo quickcheck 1.1.0 tester/TestResult# {
51 if xs.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().1 {
52 TestResultrust-analyzer cargo quickcheck 1.1.0 tester/TestResult#::discardrust-analyzer cargo quickcheck 1.1.0 tester/impl#[TestResult]discard().()
53 } else {
54 TestResultrust-analyzer cargo quickcheck 1.1.0 tester/TestResult#::from_boolrust-analyzer cargo quickcheck 1.1.0 tester/impl#[TestResult]from_bool().(
55 xs rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Vec<T, A1>`][`PartialEq<Vec<U, A2>>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Vec<T, A1>`][`PartialEq<Vec<U, A2>>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Vec<T, A1>`][`PartialEq<Vec<U, A2>>`]eq().xs.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().().into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().revrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#rev().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>(),
56 )
57 }
58 }
59 quickcheckrust-analyzer cargo quickcheck 1.1.0 tester/quickcheck().(proprust-analyzer cargo quickcheck 1.1.0 tests/prop(). as fn(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<usize>) -> TestResultrust-analyzer cargo quickcheck 1.1.0 tester/TestResult#);
60 }
61
62 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
63 fn reverse_apprust-analyzer cargo quickcheck 1.1.0 tests/reverse_app().() {
64 fn proprust-analyzer cargo quickcheck 1.1.0 tests/prop().(xs: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<usize>, ys: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<usize>) -> bool {
65 let mut app = xs.clonerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Clone]clone().();
66 app.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(ys.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().());
67 let app_rev: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<usize> = app.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().revrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#rev().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
68
69 let rxs: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<usize> = xs.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().revrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#rev().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().();
70 let mut rev_app = ys.into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().revrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#rev().().collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<usize>>();
71 rev_app.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<T>`]extend().(rxs);
72
73 app_rev rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Vec<T, A1>`][`PartialEq<Vec<U, A2>>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Vec<T, A1>`][`PartialEq<Vec<U, A2>>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Vec<T, A1>`][`PartialEq<Vec<U, A2>>`]eq().rev_app
74 }
75 quickcheckrust-analyzer cargo quickcheck 1.1.0 tester/quickcheck().(proprust-analyzer cargo quickcheck 1.1.0 tests/prop(). as fn(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<usize>, Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<usize>) -> bool);
76 }
77
78 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
79 fn maxrust-analyzer cargo quickcheck 1.1.0 tests/max().() {
80 fn proprust-analyzer cargo quickcheck 1.1.0 tests/prop().(x: isize, y: isize) -> TestResultrust-analyzer cargo quickcheck 1.1.0 tester/TestResult# {
81 if x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[isize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[isize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[isize][`PartialOrd<Self>`]gt().y {
82 TestResultrust-analyzer cargo quickcheck 1.1.0 tester/TestResult#::discardrust-analyzer cargo quickcheck 1.1.0 tester/impl#[TestResult]discard().()
83 } else {
84 TestResultrust-analyzer cargo quickcheck 1.1.0 tester/TestResult#::from_boolrust-analyzer cargo quickcheck 1.1.0 tester/impl#[TestResult]from_bool().(::stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::cmprust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/::maxrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/max().(x, y) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[isize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[isize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[isize][`PartialEq<Self>`]eq().y)
85 }
86 }
87 quickcheckrust-analyzer cargo quickcheck 1.1.0 tester/quickcheck().(proprust-analyzer cargo quickcheck 1.1.0 tests/prop(). as fn(isize, isize) -> TestResultrust-analyzer cargo quickcheck 1.1.0 tester/TestResult#);
88 }
89
90 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
91 fn sortrust-analyzer cargo quickcheck 1.1.0 tests/sort().() {
92 fn proprust-analyzer cargo quickcheck 1.1.0 tests/prop().(mut xs: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<isize>) -> bool {
93 xs.sort_unstablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]sort_unstable().();
94 for i in xs.windowsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]windows().(2) {
95 if i[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[isize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[isize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[isize][`PartialOrd<Self>`]gt().i[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().1]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). {
96 return false;
97 }
98 }
99 true
100 }
101 quickcheckrust-analyzer cargo quickcheck 1.1.0 tester/quickcheck().(proprust-analyzer cargo quickcheck 1.1.0 tests/prop(). as fn(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<isize>) -> bool);
102 }
103
104 fn sieverust-analyzer cargo quickcheck 1.1.0 tests/sieve().(n: usize) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<usize> {
105 if n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().1 {
106 return vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![];
107 }
108
109 let mut marked = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![false; n +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). 1];
110 marked[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut(). = true;
111 marked[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().1]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut(). = true;
112 marked[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().2]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut(). = true;
113 for p in 2..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#n {
114 for i in (2 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().p..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#n).filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|&n| n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().p rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().0) {
115 marked[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().i]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut(). = true;
116 }
117 }
118 marked
119 .iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().()
120 .enumeraterust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#enumerate().()
121 .filter_maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter_map().(|(i, &m)| if m { Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# } else { Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(i) })
122 .collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().()
123 }
124
125 fn is_primerust-analyzer cargo quickcheck 1.1.0 tests/is_prime().(n: usize) -> bool {
126 n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().0 && n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().1 && (2..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#).take_whilerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#take_while().(|i| i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&usize`][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&usize`][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[`&usize`][`Mul<Self>`]mul().i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]le().n).allrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#all().(|i| n rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().0)
127 }
128
129 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
130 #[should_panic]
131 fn sieve_not_primerust-analyzer cargo quickcheck 1.1.0 tests/sieve_not_prime().() {
132 fn prop_all_primerust-analyzer cargo quickcheck 1.1.0 tests/prop_all_prime().(n: u8) -> bool {
133 sieverust-analyzer cargo quickcheck 1.1.0 tests/sieve().(n as usize).into_iterrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][IntoIterator]into_iter().().allrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#all().(is_primerust-analyzer cargo quickcheck 1.1.0 tests/is_prime().)
134 }
135 quickcheckrust-analyzer cargo quickcheck 1.1.0 tester/quickcheck().(prop_all_primerust-analyzer cargo quickcheck 1.1.0 tests/prop_all_prime(). as fn(u8) -> bool);
136 }
137
138 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
139 #[should_panic]
140 fn sieve_not_all_primesrust-analyzer cargo quickcheck 1.1.0 tests/sieve_not_all_primes().() {
141 fn prop_prime_iff_in_the_sieverust-analyzer cargo quickcheck 1.1.0 tests/prop_prime_iff_in_the_sieve().(n: u8) -> bool {
142 let n = n as usize;
143 sieverust-analyzer cargo quickcheck 1.1.0 tests/sieve().(n) rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Vec<T, A1>`][`PartialEq<Vec<U, A2>>`]eq().==rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Vec<T, A1>`][`PartialEq<Vec<U, A2>>`]eq(). rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/partial_eq/impl#[`Vec<T, A1>`][`PartialEq<Vec<U, A2>>`]eq().(0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#n).filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|&i| is_primerust-analyzer cargo quickcheck 1.1.0 tests/is_prime().(i)).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<_>>()
144 }
145 quickcheckrust-analyzer cargo quickcheck 1.1.0 tester/quickcheck().(prop_prime_iff_in_the_sieverust-analyzer cargo quickcheck 1.1.0 tests/prop_prime_iff_in_the_sieve(). as fn(u8) -> bool);
146 }
147
148 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
149 fn testable_resultrust-analyzer cargo quickcheck 1.1.0 tests/testable_result().() {
150 fn resultrust-analyzer cargo quickcheck 1.1.0 tests/result().() -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<bool, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> {
151 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(true)
152 }
153 quickcheckrust-analyzer cargo quickcheck 1.1.0 tester/quickcheck().(resultrust-analyzer cargo quickcheck 1.1.0 tests/result(). as fn() -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<bool, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>);
154 }
155
156 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
157 #[should_panic]
158 fn testable_result_errrust-analyzer cargo quickcheck 1.1.0 tests/testable_result_err().() {
159 quickcheckrust-analyzer cargo quickcheck 1.1.0 tester/quickcheck().(Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#::<bool, i32> as fn(i32) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<bool, i32>);
160 }
161
162 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
163 fn testable_unitrust-analyzer cargo quickcheck 1.1.0 tests/testable_unit().() {
164 fn do_nothingrust-analyzer cargo quickcheck 1.1.0 tests/do_nothing().() {}
165 quickcheckrust-analyzer cargo quickcheck 1.1.0 tester/quickcheck().(do_nothingrust-analyzer cargo quickcheck 1.1.0 tests/do_nothing(). as fn());
166 }
167
168 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
169 fn testable_unit_panicrust-analyzer cargo quickcheck 1.1.0 tests/testable_unit_panic().() {
170 fn panicrust-analyzer cargo quickcheck 1.1.0 tests/panic().() {
171 panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!();
172 }
173 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(QuickCheckrust-analyzer cargo quickcheck 1.1.0 tester/QuickCheck#::newrust-analyzer cargo quickcheck 1.1.0 tester/impl#[QuickCheck]new().().quicktestrust-analyzer cargo quickcheck 1.1.0 tester/impl#[QuickCheck]quicktest().(panicrust-analyzer cargo quickcheck 1.1.0 tests/panic(). as fn()).is_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]is_err().());
174 }
175
176 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
177 fn regression_issue_83rust-analyzer cargo quickcheck 1.1.0 tests/regression_issue_83().() {
178 fn proprust-analyzer cargo quickcheck 1.1.0 tests/prop().(_: u8) -> bool {
179 true
180 }
181 QuickCheckrust-analyzer cargo quickcheck 1.1.0 tester/QuickCheck#::newrust-analyzer cargo quickcheck 1.1.0 tester/impl#[QuickCheck]new().().rngrust-analyzer cargo quickcheck 1.1.0 tester/impl#[QuickCheck]rng().(Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#::newrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]new().(1024)).quickcheckrust-analyzer cargo quickcheck 1.1.0 tester/impl#[QuickCheck]quickcheck().(proprust-analyzer cargo quickcheck 1.1.0 tests/prop(). as fn(u8) -> bool);
182 }
183
184 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
185 fn regression_issue_83_signedrust-analyzer cargo quickcheck 1.1.0 tests/regression_issue_83_signed().() {
186 fn proprust-analyzer cargo quickcheck 1.1.0 tests/prop().(_: i8) -> bool {
187 true
188 }
189 QuickCheckrust-analyzer cargo quickcheck 1.1.0 tester/QuickCheck#::newrust-analyzer cargo quickcheck 1.1.0 tester/impl#[QuickCheck]new().().rngrust-analyzer cargo quickcheck 1.1.0 tester/impl#[QuickCheck]rng().(Genrust-analyzer cargo quickcheck 1.1.0 arbitrary/Gen#::newrust-analyzer cargo quickcheck 1.1.0 arbitrary/impl#[Gen]new().(1024)).quickcheckrust-analyzer cargo quickcheck 1.1.0 tester/impl#[QuickCheck]quickcheck().(proprust-analyzer cargo quickcheck 1.1.0 tests/prop(). as fn(i8) -> bool);
190 }
191
192 // Test that we can show the message after panic
193 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
194 #[should_panic(expected = "foo")]
195 fn panic_msg_1rust-analyzer cargo quickcheck 1.1.0 tests/panic_msg_1().() {
196 fn proprust-analyzer cargo quickcheck 1.1.0 tests/prop().() -> bool {
197 panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("foo");
198 }
199 quickcheckrust-analyzer cargo quickcheck 1.1.0 tester/quickcheck().(proprust-analyzer cargo quickcheck 1.1.0 tests/prop(). as fn() -> bool);
200 }
201
202 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
203 #[should_panic(expected = "foo")]
204 fn panic_msg_2rust-analyzer cargo quickcheck 1.1.0 tests/panic_msg_2().() {
205 fn proprust-analyzer cargo quickcheck 1.1.0 tests/prop().() -> bool {
206 assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!("foo" == "bar");
207 true
208 }
209 quickcheckrust-analyzer cargo quickcheck 1.1.0 tester/quickcheck().(proprust-analyzer cargo quickcheck 1.1.0 tests/prop(). as fn() -> bool);
210 }
211
212 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
213 #[should_panic(expected = "foo")]
214 fn panic_msg_3rust-analyzer cargo quickcheck 1.1.0 tests/panic_msg_3().() {
215 fn proprust-analyzer cargo quickcheck 1.1.0 tests/prop().() -> bool {
216 assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("foo", "bar");
217 true
218 }
219 quickcheckrust-analyzer cargo quickcheck 1.1.0 tester/quickcheck().(proprust-analyzer cargo quickcheck 1.1.0 tests/prop(). as fn() -> bool);
220 }
221
222 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
223 #[should_panic]
224 fn regression_issue_107_hangrust-analyzer cargo quickcheck 1.1.0 tests/regression_issue_107_hang().() {
225 fn proprust-analyzer cargo quickcheck 1.1.0 tests/prop().(a: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>) -> bool {
226 a.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&1)
227 }
228 quickcheckrust-analyzer cargo quickcheck 1.1.0 tester/quickcheck().(proprust-analyzer cargo quickcheck 1.1.0 tests/prop(). as fn(_) -> bool);
229 }
230
231 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
232 #[should_panic(
233 expected = "(Unable to generate enough tests, 0 not discarded.)"
234 )]
235 fn all_tests_discarded_min_tests_passed_setrust-analyzer cargo quickcheck 1.1.0 tests/all_tests_discarded_min_tests_passed_set().() {
236 fn prop_discardedrust-analyzer cargo quickcheck 1.1.0 tests/prop_discarded().(_: u8) -> TestResultrust-analyzer cargo quickcheck 1.1.0 tester/TestResult# {
237 TestResultrust-analyzer cargo quickcheck 1.1.0 tester/TestResult#::discardrust-analyzer cargo quickcheck 1.1.0 tester/impl#[TestResult]discard().()
238 }
239
240 QuickCheckrust-analyzer cargo quickcheck 1.1.0 tester/QuickCheck#::newrust-analyzer cargo quickcheck 1.1.0 tester/impl#[QuickCheck]new().()
241 .testsrust-analyzer cargo quickcheck 1.1.0 tester/impl#[QuickCheck]tests().(16)
242 .min_tests_passedrust-analyzer cargo quickcheck 1.1.0 tester/impl#[QuickCheck]min_tests_passed().(8)
243 .quickcheckrust-analyzer cargo quickcheck 1.1.0 tester/impl#[QuickCheck]quickcheck().(prop_discardedrust-analyzer cargo quickcheck 1.1.0 tests/prop_discarded(). as fn(u8) -> TestResultrust-analyzer cargo quickcheck 1.1.0 tester/TestResult#);
244 }
245
246 #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:]
247 fn all_tests_discarded_min_tests_passed_missingrust-analyzer cargo quickcheck 1.1.0 tests/all_tests_discarded_min_tests_passed_missing().() {
248 fn prop_discardedrust-analyzer cargo quickcheck 1.1.0 tests/prop_discarded().(_: u8) -> TestResultrust-analyzer cargo quickcheck 1.1.0 tester/TestResult# {
249 TestResultrust-analyzer cargo quickcheck 1.1.0 tester/TestResult#::discardrust-analyzer cargo quickcheck 1.1.0 tester/impl#[TestResult]discard().()
250 }
251
252 QuickCheckrust-analyzer cargo quickcheck 1.1.0 tester/QuickCheck#::newrust-analyzer cargo quickcheck 1.1.0 tester/impl#[QuickCheck]new().().quickcheckrust-analyzer cargo quickcheck 1.1.0 tester/impl#[QuickCheck]quickcheck().(prop_discardedrust-analyzer cargo quickcheck 1.1.0 tests/prop_discarded(). as fn(u8) -> TestResultrust-analyzer cargo quickcheck 1.1.0 tester/TestResult#);
253 }
254
255 quickcheckrust-analyzer cargo quickcheck 1.1.0 quickcheck!! {
256 /// The following is a very simplistic test, which only verifies
257 /// that our PathBuf::arbitrary does not panic. Still, that's
258 /// something! :)
259 fn pathbufrust-analyzer cargo quickcheck 1.1.0 tests/pathbuf().(_p: PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#) -> bool {
260 true
261 }
262
263 fn basic_hashsetrust-analyzer cargo quickcheck 1.1.0 tests/basic_hashset().(_set: HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#<u8>) -> bool {
264 true
265 }
266
267 fn basic_hashmaprust-analyzer cargo quickcheck 1.1.0 tests/basic_hashmap().(_map: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<u8, u8>) -> bool {
268 true
269 }
270
271 fn substitute_hashsetrust-analyzer cargo quickcheck 1.1.0 tests/substitute_hashset().(
272 _set: HashSetrust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/set/HashSet#<u8, BuildHasherDefaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/BuildHasherDefault#<DefaultHasherrust-analyzer cargo std https://github.com/rust-lang/rust/library/std hash/random/DefaultHasher#>>
273 ) -> bool {
274 true
275 }
276
277 fn substitute_hashmaprust-analyzer cargo quickcheck 1.1.0 tests/substitute_hashmap().(
278 _map: HashMaprust-analyzer cargo std https://github.com/rust-lang/rust/library/std collections/hash/map/HashMap#<u8, u8, BuildHasherDefaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/BuildHasherDefault#<DefaultHasherrust-analyzer cargo std https://github.com/rust-lang/rust/library/std hash/random/DefaultHasher#>>
279 ) -> bool {
280 true
281 }
282
283 fn cstringrust-analyzer cargo quickcheck 1.1.0 tests/cstring().(_p: CStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/CString#) -> bool {
284 true
285 }
286 }