1
//! Comparison codegen with a runtime Ratio operand.
2

            
3
use super::common::{compile_and_validate, compile_expect_error, wrap_with_runtime_ratio};
4

            
5
/// ADR-0028: a runtime index (count) cannot be compared against a Scalar — the
6
/// implicit I32→Ratio bridge is removed, so the conflation is refused.
7
#[test]
8
1
fn runtime_index_vs_scalar_comparison_refused() {
9
1
    let err = compile_expect_error("(< (entity-count) 1/2)");
10
1
    assert!(
11
1
        err.contains("index") || err.contains("scalar") || err.contains("bridge"),
12
        "expected an index-vs-scalar refusal, got: {err}"
13
    );
14
1
}
15

            
16
#[test]
17
1
fn runtime_eq() {
18
1
    compile_and_validate(&wrap_with_runtime_ratio("(= X 0)"));
19
1
}
20

            
21
#[test]
22
1
fn runtime_lt() {
23
1
    compile_and_validate(&wrap_with_runtime_ratio("(< X 0)"));
24
1
}
25

            
26
#[test]
27
1
fn runtime_gt() {
28
1
    compile_and_validate(&wrap_with_runtime_ratio("(> X 0)"));
29
1
}
30

            
31
#[test]
32
1
fn runtime_le() {
33
1
    compile_and_validate(&wrap_with_runtime_ratio("(<= X 0)"));
34
1
}
35

            
36
#[test]
37
1
fn runtime_ge() {
38
1
    compile_and_validate(&wrap_with_runtime_ratio("(>= X 0)"));
39
1
}