All map placeholders in Caddy will output strings, not integers. CEL doesn’t have a (string, int) -> bool defined for comparison operators like >. The solution is to cast the placeholder to an int before comparing. So for example:
expression `int({testvariable_number}) > 0`
This will then do (int, int) -> bool for the comparison, which is defined.
See the CEL docs where it talks about numeric values, and the standard definitions that exist for the various types and operators.
The reason your == comparison worked is because you used "1", comparing string to string, which is defined.
Some placeholders that Caddy itself generates will give integers though, like you noticed with the error status code. That’s because the status code is an integer in http.Request in Go, so the placeholder replacer keeps the same type.