add tests for math::abs

This commit is contained in:
LinuxHeki 2023-05-20 15:36:45 +02:00
parent 1fc137a233
commit 9bbb152b4a

View File

@ -363,6 +363,9 @@ fn test_builtin_functions() {
eval("math::hypot(8.2, 1.1)"),
Ok(Value::Float((8.2 as FloatType).hypot(1.1)))
);
// Absolute
assert_eq!(eval("math::abs(15)"), Ok(Value::Float(15.0)));
assert_eq!(eval("math::abs(-15)"), Ok(Value::Float(15.0)));
// Rounding
assert_eq!(eval("floor(1.1)"), Ok(Value::Float(1.0)));
assert_eq!(eval("floor(1.9)"), Ok(Value::Float(1.0)));