Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #[cfg(test)]
- mod tests {
- use super::*;
- #[test]
- fn test1() {
- assert_eq!("-6,-3-1,3-5,7-11,14,15,17-20", solution::range_extraction(&[-6,-3,-2,-1,0,1,3,4,5,7,8,9,10,11,14,15,17,18,19,20]));
- }
- #[test]
- fn test2() {
- assert_eq!("-3--1,2,10,15,16,18-20", solution::range_extraction(&[-3,-2,-1,2,10,15,16,18,19,20]));
- }
- #[test]
- fn test3() {
- assert_eq!("1-5", solution::range_extraction(&[1, 2, 3, 4, 5]));
- }
- #[test]
- fn test4() {
- assert_eq!("1,3,5,7,9", solution::range_extraction(&[1, 3, 5, 7, 9]));
- }
- #[test]
- fn test5() {
- assert_eq!("1,3", solution::range_extraction(&[1,3]));
- }
- #[test]
- fn test6() {
- assert_eq!("1-3", solution::range_extraction(&[1, 2, 3]));
- }
- #[test]
- fn test7() {
- assert_eq!("-1-1", solution::range_extraction(&[-1, 0, 1]));
- }
- #[test]
- fn test8() {
- assert_eq!("-9--7,-5--1,1,2,4", solution::range_extraction(&[-9, -8, -7, -5, -4, -3, -2, -1, 1, 2, 4]));
- }
- #[test]
- fn test9() {
- assert_eq!("1-10,12", solution::range_extraction(&[1,2,3,4,5,6,7,8,9,10,12]));
- }
- #[test]
- fn test10() {
- assert_eq!("-9--1,1", solution::range_extraction(&[-9,-8,-7,-6,-5,-4,-3,-2,-1,1]));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement