MCPcopy Create free account
hub / github.com/chatmail/core / test_dc_param

Function test_dc_param

src/param.rs:476–509  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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() {

Callers

nothing calls this directly

Calls 4

parseMethod · 0.80
set_intMethod · 0.80
removeMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected