Add tests for operators
This commit is contained in:
parent
4cd94ff462
commit
cab894a97e
6 changed files with 54 additions and 0 deletions
21
tests/generators/nim/test_operator_binary.c
Normal file
21
tests/generators/nim/test_operator_binary.c
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
int main() {
|
||||||
|
a + b;
|
||||||
|
a - b;
|
||||||
|
(a * b);
|
||||||
|
a / b;
|
||||||
|
a % b;
|
||||||
|
a >> b;
|
||||||
|
a << b;
|
||||||
|
a && b;
|
||||||
|
a || b;
|
||||||
|
a ^ b;
|
||||||
|
|
||||||
|
a < b;
|
||||||
|
a > b;
|
||||||
|
a <= b;
|
||||||
|
a >= b;
|
||||||
|
a == b;
|
||||||
|
a != b;
|
||||||
|
(a & b);
|
||||||
|
a | b;
|
||||||
|
}
|
||||||
19
tests/generators/nim/test_operator_binary.nim
Normal file
19
tests/generators/nim/test_operator_binary.nim
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
proc main(): cint =
|
||||||
|
a + b
|
||||||
|
a - b
|
||||||
|
(a * b)
|
||||||
|
a / b
|
||||||
|
a mod b
|
||||||
|
a shr b
|
||||||
|
a shl b
|
||||||
|
a and b
|
||||||
|
a or b
|
||||||
|
a xor b
|
||||||
|
a < b
|
||||||
|
a > b
|
||||||
|
a <= b
|
||||||
|
a >= b
|
||||||
|
a == b
|
||||||
|
a != b
|
||||||
|
(a and b)
|
||||||
|
a or b
|
||||||
4
tests/generators/nim/test_operator_postfix.c
Normal file
4
tests/generators/nim/test_operator_postfix.c
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
int main() {
|
||||||
|
a++;
|
||||||
|
b--;
|
||||||
|
}
|
||||||
3
tests/generators/nim/test_operator_postfix.nim
Normal file
3
tests/generators/nim/test_operator_postfix.nim
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
proc main(): cint =
|
||||||
|
postInc(a)
|
||||||
|
postDec(b)
|
||||||
4
tests/generators/nim/test_operator_prefix.c
Normal file
4
tests/generators/nim/test_operator_prefix.c
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
int main() {
|
||||||
|
++a;
|
||||||
|
--b;
|
||||||
|
}
|
||||||
3
tests/generators/nim/test_operator_prefix.nim
Normal file
3
tests/generators/nim/test_operator_prefix.nim
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
proc main(): cint =
|
||||||
|
preInc(a)
|
||||||
|
preDec(b)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue