Add tests for previous commit
This commit is contained in:
parent
ded58071a1
commit
cccf36eb4f
21 changed files with 86 additions and 3 deletions
3
tests/generators/nim/test_array_access.c
Normal file
3
tests/generators/nim/test_array_access.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int main() {
|
||||
a[i++];
|
||||
}
|
||||
2
tests/generators/nim/test_array_access.nim
Normal file
2
tests/generators/nim/test_array_access.nim
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
proc main(): cint =
|
||||
a[postInc(i)]
|
||||
3
tests/generators/nim/test_cast_simple.c
Normal file
3
tests/generators/nim/test_cast_simple.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int main() {
|
||||
(double) 20;
|
||||
}
|
||||
2
tests/generators/nim/test_cast_simple.nim
Normal file
2
tests/generators/nim/test_cast_simple.nim
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
proc main(): cint =
|
||||
cast[cdouble](20)
|
||||
5
tests/generators/nim/test_conditional_if.c
Normal file
5
tests/generators/nim/test_conditional_if.c
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
int main() {
|
||||
if (a > b) {
|
||||
printf("A is greater");
|
||||
}
|
||||
}
|
||||
3
tests/generators/nim/test_conditional_if.nim
Normal file
3
tests/generators/nim/test_conditional_if.nim
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
proc main(): cint =
|
||||
if(a > b):
|
||||
printf("A is greater")
|
||||
8
tests/generators/nim/test_conditional_ifelse.c
Normal file
8
tests/generators/nim/test_conditional_ifelse.c
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
int main() {
|
||||
if (a > b) {
|
||||
printf("A is greater");
|
||||
}
|
||||
else {
|
||||
printf("B is greater or equal");
|
||||
}
|
||||
}
|
||||
5
tests/generators/nim/test_conditional_ifelse.nim
Normal file
5
tests/generators/nim/test_conditional_ifelse.nim
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
proc main(): cint =
|
||||
if(a > b):
|
||||
printf("A is greater")
|
||||
else:
|
||||
printf("B is greater or equal")
|
||||
11
tests/generators/nim/test_conditional_ifelseif.c
Normal file
11
tests/generators/nim/test_conditional_ifelseif.c
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
int main() {
|
||||
if (a > b) {
|
||||
printf("A is greater");
|
||||
}
|
||||
else if (a == b) {
|
||||
printf("A and B are equal");
|
||||
}
|
||||
else {
|
||||
printf("A is less than B");
|
||||
}
|
||||
}
|
||||
7
tests/generators/nim/test_conditional_ifelseif.nim
Normal file
7
tests/generators/nim/test_conditional_ifelseif.nim
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
proc main(): cint =
|
||||
if(a > b):
|
||||
printf("A is greater")
|
||||
elif(a == b):
|
||||
printf("A and B are equal")
|
||||
else:
|
||||
printf("A is less than B")
|
||||
3
tests/generators/nim/test_expression_cond.c
Normal file
3
tests/generators/nim/test_expression_cond.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int main() {
|
||||
j = i < 0 ? -5 : 5;
|
||||
}
|
||||
2
tests/generators/nim/test_expression_cond.nim
Normal file
2
tests/generators/nim/test_expression_cond.nim
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
proc main(): cint =
|
||||
j = if i < 0: -5 else: 5
|
||||
3
tests/generators/nim/test_expression_sizeof.c
Normal file
3
tests/generators/nim/test_expression_sizeof.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int main() {
|
||||
sizeof a;
|
||||
}
|
||||
2
tests/generators/nim/test_expression_sizeof.nim
Normal file
2
tests/generators/nim/test_expression_sizeof.nim
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
proc main(): cint =
|
||||
sizeof(a)
|
||||
3
tests/generators/nim/test_expression_sizeof_type.c
Normal file
3
tests/generators/nim/test_expression_sizeof_type.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int main() {
|
||||
sizeof(int);
|
||||
}
|
||||
2
tests/generators/nim/test_expression_sizeof_type.nim
Normal file
2
tests/generators/nim/test_expression_sizeof_type.nim
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
proc main(): cint =
|
||||
sizeof(cint)
|
||||
3
tests/generators/nim/test_struct_record_access.c
Normal file
3
tests/generators/nim/test_struct_record_access.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int main() {
|
||||
a.twenty;
|
||||
}
|
||||
2
tests/generators/nim/test_struct_record_access.nim
Normal file
2
tests/generators/nim/test_struct_record_access.nim
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
proc main(): cint =
|
||||
a.twenty
|
||||
3
tests/generators/nim/test_struct_record_access_ptr.c
Normal file
3
tests/generators/nim/test_struct_record_access_ptr.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
int main() {
|
||||
a->twenty;
|
||||
}
|
||||
2
tests/generators/nim/test_struct_record_access_ptr.nim
Normal file
2
tests/generators/nim/test_struct_record_access_ptr.nim
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
proc main(): cint =
|
||||
a.twenty
|
||||
Loading…
Add table
Add a link
Reference in a new issue