Skip to content

Commit

Permalink
added more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Westsi committed Jul 2, 2024
1 parent 8bc53f7 commit 14a754f
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 3 deletions.
3 changes: 2 additions & 1 deletion ci/test/arithmetic.dor
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ int main() {
int x = 3
int y = 8
int z = x * y + 2
return z
int a = z / 2
return a - 3
}
6 changes: 6 additions & 0 deletions ci/test/define.dor
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@define FOUR 4

int main() {
int x = FOUR * 2
return x
}
11 changes: 11 additions & 0 deletions ci/test/fnargs.dor
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
int mul(int x, int y) {
return x * y
}

int main() {
int a = 2
int b = 3
int s = mul(a, b)
s = s + mul(7, 4)
return s
}
9 changes: 9 additions & 0 deletions ci/test/fncall.dor
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
int test() {
int x = 27
return x
}

int main() {
int r = test()
return r
}
8 changes: 8 additions & 0 deletions ci/test/if.dor
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
int main() {
int x = 8
if (x > 6) {
return 1
} else {
return 0
}
}
6 changes: 6 additions & 0 deletions ci/test/import.dor
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@import "imported"

int main() {
int x = impfunc()
return x
}
5 changes: 5 additions & 0 deletions ci/test/imported.dor
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
int impfunc() {
int x = 8
int y = 6
return x * y / 2
}
8 changes: 7 additions & 1 deletion ci/test/metadata.tests
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
return:0
varret:3
arithmetic:26
arithmetic:10
if:1
define:8
import:24
fncall:27
fnargs:34
while:3
9 changes: 9 additions & 0 deletions ci/test/while.dor
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
int main() {
int a = 2
int s = 0
while (a < 5) {
s = s + 1
a = a + 1
}
return s
}
2 changes: 1 addition & 1 deletion dormouse/armbasic.dor
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ int fn() {
}

int main() {
int x = fn() ^ 11
int x = fn() * 3
return x
}

0 comments on commit 14a754f

Please sign in to comment.