Add tests for more binary operators

This commit is contained in:
Dirkjan Ochtman 2017-02-17 14:59:04 +01:00
parent 3003e58658
commit b84a1242c4
2 changed files with 25 additions and 1 deletions

View File

@ -7,3 +7,27 @@
{% if a % c == b -%}
mod
{%- endif -%}
{% if a + b == c -%}
add
{%- endif -%}
{% if a << b == c -%}
rsh
{%- endif -%}
{% if c >> b == a -%}
lsh
{%- endif -%}
{% if a & b == b -%}
band
{%- endif -%}
{% if b ^ c == a + c -%}
bxor
{%- endif -%}
{% if b | c == a + c -%}
bor
{%- endif -%}
{% if a == b && a + b == c -%}
and
{%- endif -%}
{% if a == c || a == b -%}
or
{%- endif -%}

View File

@ -30,5 +30,5 @@ struct OperatorsTemplate {
#[test]
fn test_operators() {
let t = OperatorsTemplate { a: 1, b: 1, c: 2 };
assert_eq!(t.render(), "muldivmod");
assert_eq!(t.render(), "muldivmodaddrshlshbandbxorborandor");
}