Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
Tests/Core/CustomExpressionFunctions/CustomExpressionFunctions.asm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.gba | ||
.create "output.bin",0 | ||
|
||
.macro check,exp,value | ||
.if (exp) != value | ||
.error "Error: " + °(exp) + " = " + (exp) + " != " + value | ||
.endif | ||
.endmacro | ||
|
||
; simple function with multiple parameters | ||
.expfunc lerp(a, b, t), a + t*(b-a) | ||
|
||
check lerp(1, 5, 0.75), 4 | ||
|
||
; resursive function | ||
.expfunc fib(n), n <= 0 ? 0 : n <= 2 ? 1 : fib(n-1)+fib(n-2) | ||
|
||
check fib(0), 0 | ||
check fib(2), 1 | ||
check fib(8), 21 | ||
|
||
; function that depends on architecture specific functions. Change the architecture afterwards to check | ||
; if it has any influence | ||
.expfunc isArmWrapper(), isArm() | ||
|
||
check isArmWrapper(), 0 | ||
|
||
.psp | ||
|
||
.close |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|