Lines
100 %
Functions
Branches
//! Comparison codegen with a runtime Ratio operand.
use super::common::{compile_and_validate, compile_expect_error, wrap_with_runtime_ratio};
/// ADR-0028: a runtime index (count) cannot be compared against a Scalar — the
/// implicit I32→Ratio bridge is removed, so the conflation is refused.
#[test]
fn runtime_index_vs_scalar_comparison_refused() {
let err = compile_expect_error("(< (entity-count) 1/2)");
assert!(
err.contains("index") || err.contains("scalar") || err.contains("bridge"),
"expected an index-vs-scalar refusal, got: {err}"
);
}
fn runtime_eq() {
compile_and_validate(&wrap_with_runtime_ratio("(= X 0)"));
fn runtime_lt() {
compile_and_validate(&wrap_with_runtime_ratio("(< X 0)"));
fn runtime_gt() {
compile_and_validate(&wrap_with_runtime_ratio("(> X 0)"));
fn runtime_le() {
compile_and_validate(&wrap_with_runtime_ratio("(<= X 0)"));
fn runtime_ge() {
compile_and_validate(&wrap_with_runtime_ratio("(>= X 0)"));