Sha256: 305ca40ba41ed3b459a334386cd742c66586d62aadfb624278aabdf10b872a12

Contents?: true

Size: 962 Bytes

Versions: 38

Compression:

Stored size: 962 Bytes

Contents

use rayon::prelude::*;

#[test]
fn drain_vec_yielded() {
    let mut vec_org = vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9];

    let yielded = vec_org.par_drain(0..5).collect::<Vec<_>>();

    assert_eq!(&yielded, &[0, 1, 2, 3, 4]);
    assert_eq!(&vec_org, &[5, 6, 7, 8, 9]);
}

#[test]
fn drain_vec_dropped() {
    let mut vec_org = vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9];

    let yielded = vec_org.par_drain(0..5);

    drop(yielded);
    assert_eq!(&vec_org, &[5, 6, 7, 8, 9]);
}

#[test]
fn drain_vec_empty_range_yielded() {
    let mut vec_org = vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9];

    let yielded = vec_org.par_drain(5..5).collect::<Vec<_>>();

    assert_eq!(&yielded, &[]);
    assert_eq!(&vec_org, &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
}

#[test]
fn drain_vec_empty_range_dropped() {
    let mut vec_org = vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9];

    let yielded = vec_org.par_drain(5..5);

    drop(yielded);
    assert_eq!(&vec_org, &[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
}

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/rayon-1.10.0/tests/drain_vec.rs
wasmtime-28.0.0 ./ext/cargo-vendor/rayon-1.10.0/tests/drain_vec.rs
wasmtime-27.0.0 ./ext/cargo-vendor/rayon-1.10.0/tests/drain_vec.rs
wasmtime-26.0.0 ./ext/cargo-vendor/rayon-1.10.0/tests/drain_vec.rs
wasmtime-25.0.2 ./ext/cargo-vendor/rayon-1.10.0/tests/drain_vec.rs
wasmtime-25.0.1 ./ext/cargo-vendor/rayon-1.10.0/tests/drain_vec.rs
wasmtime-25.0.0 ./ext/cargo-vendor/rayon-1.10.0/tests/drain_vec.rs
wasmtime-24.0.0 ./ext/cargo-vendor/rayon-1.10.0/tests/drain_vec.rs
wasmtime-23.0.2 ./ext/cargo-vendor/rayon-1.8.0/tests/drain_vec.rs
wasmtime-22.0.0 ./ext/cargo-vendor/rayon-1.8.0/tests/drain_vec.rs
wasmtime-21.0.1 ./ext/cargo-vendor/rayon-1.8.0/tests/drain_vec.rs
wasmtime-20.0.2 ./ext/cargo-vendor/rayon-1.8.0/tests/drain_vec.rs
wasmtime-20.0.0 ./ext/cargo-vendor/rayon-1.8.0/tests/drain_vec.rs
wasmtime-18.0.3 ./ext/cargo-vendor/rayon-1.8.0/tests/drain_vec.rs
wasmtime-17.0.1 ./ext/cargo-vendor/rayon-1.8.0/tests/drain_vec.rs
wasmtime-17.0.0 ./ext/cargo-vendor/rayon-1.8.0/tests/drain_vec.rs
wasmtime-16.0.0 ./ext/cargo-vendor/rayon-1.8.0/tests/drain_vec.rs
wasmtime-15.0.1 ./ext/cargo-vendor/rayon-1.8.0/tests/drain_vec.rs
wasmtime-15.0.0 ./ext/cargo-vendor/rayon-1.8.0/tests/drain_vec.rs
wasmtime-14.0.4 ./ext/cargo-vendor/rayon-1.8.0/tests/drain_vec.rs