same_elements

Crates.iosame_elements
lib.rssame_elements
version0.1.0
sourcesrc
created_at2021-01-05 11:37:57.503459
updated_at2021-01-05 11:37:57.503459
descriptionFunction to test if two collections contain the same values
homepage
repositoryhttps://github.com/scott97/same_elements
max_upload_size
id332058
size20,550
Scott Barnard (scott97)

documentation

README

Same Elements

Function to test if two collections contain the same values.

Sometimes when creating unit tests, I need to test that two slices contain the same values, but not necessarily in the same order. You can sort the values before testing that the two slices are identical, or alternatively, you can use this crate instead.

Example code

use same_elements::*;

let a = [1,2,3,4,5];
let b = [2,4,1,3,5];
assert!(a.same_elements(&b));
Commit count: 0

cargo fmt