-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path007.fun
More file actions
68 lines (58 loc) · 1.68 KB
/
007.fun
File metadata and controls
68 lines (58 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Test 1: this test ensures that stacked calls to functions with large numbers of parameters function correctly
# Taken from "Elegy for Hallownest" from Hollow Knight by Team Cherry
fun a(In, wilds, beyond, they, speak, your, name, with, reverence, and, regret){
x = 6
print(x)
return b(In, wilds, beyond, they, speak, your, name, with, reverence, and, regret, 0)
}
fun b(For, none, could, tame, our, savage, souls, yet, you, the, challenge, met){
return c(For, none, could, tame, our, savage, souls, yet, you, the, challenge)
}
fun c(Under, palest, watch, you, taught, we, changed, base, instincts, were, redeemed){
return d(Under, palest, watch, you, taught, we, changed, base, instincts, were, redeemed, 0, 0)
}
fun d(A, world, you, gave, to, bug, and, beast, as, they, had, never, dreamed){
return A - world + you/gave * (to + bug) - and + beast + as / (they % had)
}
# This test ensures that nested if statements and complex conditional statements work correctly
fun test2(){
if(1){
print(1)
if(!!(5 == 5 > 3)){
print(1)
}
print(0)
if(((8+4) / 3 == 4) || test2Helper()){
print(1)
}
}
}
# Ensures short circuiting is not utilized
fun test2Helper(){
print(8)
}
# Test 3: A simple stress test
fun stressTest(a){
if(!a){
return 0
}
x = 0
while(x < 1000000){
x = x + 1
}
print(a)
stressTest(a - 1)
}
# You should get:
# 6 (from test 1)
# 31 (from test 1)
# 1 (from test 2)
# 0 (from test 2)
# 8 (from test 2)
# 1 (from test 2)
# Numbers from 200 to 1 (from test 3)
fun main(){
print (a(1, 2, 4, 2, 5, 6, 7, 8, 9, 10, 3))
test2()
stressTest(200)
}