Files
regorus/tests/interpreter/cases/arithmetic/mod.rs
Ming-Wei Shih c0972ad2ba Update license to MIT
Signed-off-by: Ming-Wei Shih <mishih@microsoft.com>
2023-02-09 19:40:35 +00:00

47 lines
646 B
Rust

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#![cfg(test)]
use crate::interpreter::*;
use anyhow::Result;
#[test]
fn basic() -> Result<()> {
let rego = r#"
package test
add {
1 + 2 == 3
}
sub {
5 - 1 == 4
}
mul {
3 * 4 == 12
}
# Lock down float operation.
div {
21 / 5 == 4.2
}
"#;
let expected = Value::from_json_str(
r#" {
"add" : true,
"sub" : true,
"mul" : true,
"div" : true
}"#,
)?;
assert_eq!(
eval_file(&[rego.to_owned()], None, None, "data.test")?,
expected
);
Ok(())
}