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
8 changes: 5 additions & 3 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ jobs:
uses: actions/checkout@v2
- name: Install Rust
run: |
rustup toolchain install nightly-2021-01-19
rustup default nightly-2021-01-19
rustup component add rustfmt miri
MIRI_NIGHTLY=nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri)
echo "Installing latest nightly with Miri: $MIRI_NIGHTLY"
rustup set profile minimal
rustup default "$MIRI_NIGHTLY"
rustup component add miri
- name: Run
run: |
make miri
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
test:
cargo test -- --nocapture
cargo test -- --ignored -- --nocapture

miri:
cargo miri test -- --nocapture
Expand Down
16 changes: 16 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,22 @@ mod tests {
/// verifies the result against std's `sort`.
#[test]
fn sorted_random_u64_test() {
let mut rng = rand::thread_rng();
let vec_size = 1025;
let partial_size = (rng.gen::<u64>() % vec_size) as usize;
let mut data = (0u64..vec_size)
.map(|_| rng.gen::<u64>())
.collect::<Vec<u64>>();
let mut d = data.clone();
d.sort();

data.partial_sort(partial_size, |a, b| a.cmp(b));
assert_eq!(&d[0..partial_size], &data.as_slice()[0..partial_size]);
}

#[test]
#[ignore]
fn sorted_expensive_random_u64_test() {
for _ in 0..100 {
let mut rng = rand::thread_rng();
let vec_size = 1025;
Expand Down