crftng-intrprtrs/tests/integration_test.rs

20 lines
517 B
Rust
Raw Normal View History

2022-04-03 21:54:39 +02:00
use crftng_intrprtrs::interpreter::types;
2022-04-03 22:07:19 +02:00
use crftng_intrprtrs::run;
2022-04-03 21:54:39 +02:00
#[test]
fn test_one_equality() {
run_check_result_eq_bool("1 == 1", true);
run_check_result_eq_bool("1 >= 1", true);
run_check_result_eq_bool("1 <= 1", true);
run_check_result_eq_bool("1 != 1", false);
run_check_result_eq_bool("1 > 1", false);
run_check_result_eq_bool("1 < 1", false);
}
fn run_check_result_eq_bool(code: &str, value: bool) {
2022-04-03 22:07:19 +02:00
assert_eq!(
run(code).unwrap(),
types::Value::Primitive(types::Primitive::Bool(value))
)
2022-04-03 21:54:39 +02:00
}