-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
I was working through the examples in rust-advanced-testing-workshop/collections, and got stuck at this exercise:
#[googletest::gtest]
fn failed_subset_of() {
let x = btreeset![1, 2, 3];
let y = btreeset![3, 4];
assert!(y.is_subset(&x));
}
I gave it a solid 30 minutes of trying in various ways, but I couldn't figure out how to write this particular test. This is the closest I'd gotten:
assert_that!(y, subset_of(x.iter().collect::<std::collections::BTreeSet<&i32>>()));
I don't think this is a good way to do this, but I can't figure out how to massage x
into an acceptable form.
It would be helpful if the examples in the docs for subset_of()
showed usage from variables (of different collection types), rather than just arrays. The test module in subset_of.rs
is similarly unhelpful. There isn't a large body of code using googletest-rust
, so searching online also led nowhere.
Metadata
Metadata
Assignees
Labels
No labels