Mercurial > hg > truffle
annotate graal/com.oracle.truffle.sl.test/tests/Call.sl @ 15107:1bf700e19e84
Make Loop generic.
author | Josef Eisl <josef.eisl@jku.at> |
---|---|
date | Wed, 09 Apr 2014 17:11:48 +0200 |
parents | b16ec83edc73 |
children |
rev | line source |
---|---|
13762
e34d5cca7496
Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
1 function ret(a) { return a; } |
e34d5cca7496
Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
2 function dub(a) { return a * 2; } |
e34d5cca7496
Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
3 function inc(a) { return a + 1; } |
e34d5cca7496
Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
4 function dec(a) { return a - 1; } |
e34d5cca7496
Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
5 function call(f, v) { return f(v); } |
e34d5cca7496
Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
6 |
e34d5cca7496
Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
7 function main() { |
13821
b16ec83edc73
Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13762
diff
changeset
|
8 println(ret(42)); |
b16ec83edc73
Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13762
diff
changeset
|
9 println(dub(21)); |
b16ec83edc73
Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13762
diff
changeset
|
10 println(inc(41)); |
b16ec83edc73
Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13762
diff
changeset
|
11 println(dec(43)); |
b16ec83edc73
Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13762
diff
changeset
|
12 println(call(ret, 42)); |
b16ec83edc73
Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13762
diff
changeset
|
13 println(call(dub, 21)); |
b16ec83edc73
Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13762
diff
changeset
|
14 println(call(inc, 41)); |
b16ec83edc73
Documentation and more refactoring of Simple Language
Christian Wimmer <christian.wimmer@oracle.com>
parents:
13762
diff
changeset
|
15 println(call(dec, 43)); |
13762
e34d5cca7496
Use source and expected output files to test Simple Language, instead of individual JUnit tests with the source and expected output as strings
Christian Wimmer <christian.wimmer@oracle.com>
parents:
diff
changeset
|
16 } |