Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- verify `cargo fmt` availability and install `rustfmt` via rustup if missing
- note that the `pyo3` feature requires Python development libraries
- documented safety requirements for `erase_lifetime`
- replaced `quickcheck` property tests with `proptest`

## 0.19.3 - 2025-05-30
- implemented `Error` for `ViewError`
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ zerocopy = { version = "0.8.26", optional = true, features = ["derive"] }
pyo3 = { version = "0.25.1", optional = true }

[dev-dependencies]
quickcheck = "1.0"
proptest = "1.7"

[features]
default = ["mmap", "zerocopy"]
Expand Down
16 changes: 10 additions & 6 deletions src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,25 @@
* LICENSE file in the root directory of this source tree.
*/

use quickcheck::quickcheck;
use proptest::prelude::*;

use crate::Bytes;

quickcheck! {
fn test_shallow_clone(v: Vec<u8>) -> bool {
proptest! {
#[test]
fn test_shallow_clone(v in proptest::collection::vec(any::<u8>(), 0..256)) {
let a: Bytes = v.into();
let b: Bytes = a.clone();
a == b && a.as_ptr() == b.as_ptr()
prop_assert_eq!(a.as_ref(), b.as_ref());
prop_assert_eq!(a.as_ptr(), b.as_ptr());
}

fn test_shallow_slice(v: Vec<u8>) -> bool {
#[test]
fn test_shallow_slice(v in proptest::collection::vec(any::<u8>(), 0..256)) {
let a: Bytes = v.into();
let b: Bytes = a.slice(..a.len() / 2);
&b[..] == &a[..b.len()] && (b.is_empty() || a.as_ptr() == b.as_ptr())
prop_assert_eq!(&b[..], &a[..b.len()]);
prop_assert!(b.is_empty() || a.as_ptr() == b.as_ptr());
}
}

Expand Down
Loading