use magazine_cutout::*; #[test] fn test_example_works() { let magazine = "two times three is not four" .split_whitespace() .collect::>(); let note = "two times two is four" .split_whitespace() .collect::>(); assert!(!can_construct_note(&magazine, ¬e)); } #[test] fn test_fn_returns_true_for_good_input() { let magazine = "The metro orchestra unveiled its new grand piano today. Its donor paraphrased Nathn Hale: \"I only regret that I have but one to give \"".split_whitespace().collect::>(); let note = "give one grand today." .split_whitespace() .collect::>(); assert!(can_construct_note(&magazine, ¬e)); } #[test] fn test_fn_returns_false_for_bad_input() { let magazine = "I've got a lovely bunch of coconuts." .split_whitespace() .collect::>(); let note = "I've got som coconuts" .split_whitespace() .collect::>(); assert!(!can_construct_note(&magazine, ¬e)); } #[test] fn test_case_sensitivity() { let magazine = "i've got some lovely coconuts" .split_whitespace() .collect::>(); let note = "I've got some coconuts" .split_whitespace() .collect::>(); assert!(!can_construct_note(&magazine, ¬e)); let magazine = "I've got some lovely coconuts" .split_whitespace() .collect::>(); let note = "i've got some coconuts" .split_whitespace() .collect::>(); assert!(!can_construct_note(&magazine, ¬e)); } #[test] fn test_magzine_has_more_than_words_available_than_needed() { let magazine = "Enough is enough when enough is enough" .split_whitespace() .collect::>(); let note = "enough is enough".split_whitespace().collect::>(); assert!(can_construct_note(&magazine, ¬e)); }