| 474 | |
| 475 | #[test] |
| 476 | fn test_dc_param() { |
| 477 | let mut p1: Params = "a=1\nw=2\nc=3".parse().unwrap(); |
| 478 | |
| 479 | assert_eq!(p1.get_int(Param::Forwarded), Some(1)); |
| 480 | assert_eq!(p1.get_int(Param::Width), Some(2)); |
| 481 | assert_eq!(p1.get_int(Param::Height), None); |
| 482 | assert!(!p1.exists(Param::Height)); |
| 483 | |
| 484 | p1.set_int(Param::Duration, 4); |
| 485 | |
| 486 | assert_eq!(p1.get_int(Param::Duration), Some(4)); |
| 487 | |
| 488 | let mut p1 = Params::new(); |
| 489 | |
| 490 | p1.set(Param::Forwarded, "foo") |
| 491 | .set_int(Param::Width, 2) |
| 492 | .remove(Param::GuaranteeE2ee) |
| 493 | .set_int(Param::Duration, 4); |
| 494 | |
| 495 | assert_eq!(p1.to_string(), "a=foo\nd=4\nw=2"); |
| 496 | |
| 497 | p1.remove(Param::Width); |
| 498 | |
| 499 | assert_eq!(p1.to_string(), "a=foo\nd=4",); |
| 500 | assert_eq!(p1.len(), 2); |
| 501 | |
| 502 | p1.remove(Param::Forwarded); |
| 503 | p1.remove(Param::Duration); |
| 504 | |
| 505 | assert_eq!(p1.to_string(), "",); |
| 506 | |
| 507 | assert!(p1.is_empty()); |
| 508 | assert_eq!(p1.len(), 0) |
| 509 | } |
| 510 | |
| 511 | #[test] |
| 512 | fn test_roundtrip() { |