MCPcopy Create free account
hub / github.com/cel-rust/cel-rust / test_max

Function test_max

cel/src/functions.rs:544–563  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

542
543 #[test]
544 fn test_max() {
545 [
546 ("max single", "max(1) == 1"),
547 ("max multiple", "max(1, 2, 3) == 3"),
548 ("max negative", "max(-1, 0) == 0"),
549 ("max float", "max(-1.0, 0.0) == 0.0"),
550 ("max list", "max([1, 2, 3]) == 3"),
551 ("max empty list", "max([]) == null"),
552 ("max no args", "max() == null"),
553 ]
554 .iter()
555 .for_each(|a| {
556 let input: &(&str, &str) = a;
557 let mut context = Context::default();
558 context.add_function("max", super::max);
559 let ctx = Some(context);
560 let r = test_script(input.1, ctx);
561 assert_eq!(r, Ok(true.into()), "{}", input.0);
562 });
563 }
564
565 #[test]
566 fn test_min() {

Callers

nothing calls this directly

Calls 3

test_scriptFunction · 0.85
add_functionMethod · 0.80
iterMethod · 0.45

Tested by

no test coverage detected