-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.snb
63 lines (45 loc) · 1.61 KB
/
test.snb
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
include "lib/core.snb"
include "games/sound.snb"
#===================playground======================
testSound()
sleep(120)
#================interpreter comparison bug================
assertEx(0 < 1, 200000)
assertEx(0 <= 1, 200001)
assertEx(1 > 0, 200002)
assertEx(1 >= 0, 200003)
#===================random======================
# won't produce negative value
i -> 0
while i < 100000
assertEx(0 <= random(99999), 200004)
i -> i + 1
#===================pow======================
assertEx(pow(10, 3) = 1000, 200005)
assertEx(pow(0, 0) = 1, 200006)
#===================sqrt======================
assertEx(sqrt(1) = 1, 200007)
assertEx(sqrt(2) = 1, 200008)
assertEx(sqrt(4) = 2, 200009)
#===================interpreter big literal bug======================
assertEx(4073741823 = 4073741823, 200010)
#===================max arguments length======================
def testArg(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z)
memory[a] -> a
memory[m] -> m
memory[z] -> z
testArg(1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8,9,1,2,3,4,5,6,7,8)
assertEx(memory[1] = 1, 200011)
assertEx(memory[4] = 4, 200012)
assertEx(memory[8] = 8, 200013)
#===================triangular functions======================
assertEx(and((PI / 6) < atan2(1, 1), atan2(1, 1) < (PI / 2)), 200014)
assertEx(cos(PI / 2) = 0, 200015)
assertEx(cos(60) = 82, 200016)
assertEx(cos(60 + PI) = -82, 200017)
assertEx(cos(60 + (3 * PI)) = -82, 200018)
assertEx(sin(0) = 0, 200019)
assertEx(sin(PI / 2) = 100, 200020)
assertEx(sin(7 * PI / 2) = -100, 200021)
#===================interpreter specific literal bug======================
# assertEx(2147483648 > 0, 200022)