| 29 | } |
| 30 | |
| 31 | fn invoke(&self, args: &[Value], _context: &Context) -> Result<Value, DscError> { |
| 32 | debug!("{}", t!("functions.lessOrEquals.invoked")); |
| 33 | |
| 34 | let first = &args[0]; |
| 35 | let second = &args[1]; |
| 36 | |
| 37 | if let (Some(num1), Some(num2)) = (first.as_i64(), second.as_i64()) { |
| 38 | return Ok(Value::Bool(num1 <= num2)); |
| 39 | } |
| 40 | |
| 41 | if let (Some(str1), Some(str2)) = (first.as_str(), second.as_str()) { |
| 42 | return Ok(Value::Bool(str1 <= str2)); |
| 43 | } |
| 44 | |
| 45 | Err(DscError::Parser(t!("functions.typeMismatch").to_string())) |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | #[cfg(test)] |