# TODO: revert to cue eval -i post fix for #1786
! exec cue eval -c bounds.cue
cmp stderr expect-stderr

-- frontmatter.toml --
title = "Bounds"
description = ""

-- text.md --
Bounds define a lower bound, upper bound, or inequality for a certain value.
They work on numbers, strings, bytes and null.

The bound is defined for all values for which the corresponding comparison
operation is defined.
For instance `>5.0` allows all floating point values greater than `5.0`,
whereas `<0` allows all negative numbers (int or float).

-- bounds.cue --
#rn: >=3 & <8        // type int | float
#ri: >=3 & <8 & int  // type int
#rf: >=3 & <=8.0     // type float
#rs: >="a" & <"mo"

a: #rn & 3.5
b: #ri & 3.5
c: #rf & 3
d: #rs & "ma"
e: #rs & "mu"

r1: #rn & >=5 & <10

-- expect-stderr --
b: conflicting values int and 3.5 (mismatched types int and float):
    ./bounds.cue:2:17
    ./bounds.cue:7:10
e: invalid value "mu" (out of bound <"mo"):
    ./bounds.cue:4:14
    ./bounds.cue:10:10
