mirror of
https://github.com/MorizzG/rlox.git
synced 2025-12-06 12:22:42 +00:00
added tests
This commit is contained in:
parent
1cca1494a4
commit
660464638f
255 changed files with 7220 additions and 3 deletions
26
interpreter/tests/lox/function/parameters.lox
Normal file
26
interpreter/tests/lox/function/parameters.lox
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
fun f0() { return 0; }
|
||||
print f0(); // expect: 0
|
||||
|
||||
fun f1(a) { return a; }
|
||||
print f1(1); // expect: 1
|
||||
|
||||
fun f2(a, b) { return a + b; }
|
||||
print f2(1, 2); // expect: 3
|
||||
|
||||
fun f3(a, b, c) { return a + b + c; }
|
||||
print f3(1, 2, 3); // expect: 6
|
||||
|
||||
fun f4(a, b, c, d) { return a + b + c + d; }
|
||||
print f4(1, 2, 3, 4); // expect: 10
|
||||
|
||||
fun f5(a, b, c, d, e) { return a + b + c + d + e; }
|
||||
print f5(1, 2, 3, 4, 5); // expect: 15
|
||||
|
||||
fun f6(a, b, c, d, e, f) { return a + b + c + d + e + f; }
|
||||
print f6(1, 2, 3, 4, 5, 6); // expect: 21
|
||||
|
||||
fun f7(a, b, c, d, e, f, g) { return a + b + c + d + e + f + g; }
|
||||
print f7(1, 2, 3, 4, 5, 6, 7); // expect: 28
|
||||
|
||||
fun f8(a, b, c, d, e, f, g, h) { return a + b + c + d + e + f + g + h; }
|
||||
print f8(1, 2, 3, 4, 5, 6, 7, 8); // expect: 36
|
||||
Loading…
Add table
Add a link
Reference in a new issue