Debian Codegraph @

test/fon/manual_formulas.cpp.praat

raw
1 # File fon/manual_formulas.cpp.praat
2 # Generated by test/createPraatTests.praat
3
4 # Tests for the manual page "Operators".
5
6 assert --6 = 6
7 assert 2^6 = 64
8
9 assert 2^-6 = 0.015625
10
11 assert -(1+1)^6 = -64
12
13 assert 4^3^2 = 262144
14
15 assert 4^3 ^ 2 = 262144
16
17 assert (4 ^ 3) ^ 2 = 4096
18
19 assert (-2)^6 = 64
20
21 assert -(2^6) = -64
22
23 assert -(2)^6 = -64
24
25 assert 1/4*5 = 1.25
26 assert 1 / 4*5 = 1.25
27 assert 1 / (4*5) = 0.05
28
29 assert 3 * 2 ^ 4 = 48
30 assert 3*2 ^ 4 = 48
31 assert (3 * 2) ^ 4 = 1296
32
33 assert 54 div 5 = 10
34
35 assert 54 mod 5 = 4
36
37 assert 54.3 div 5.1 = 10
38
39 assert abs ((54.3 mod 5.1) - 3.3) < 1e-14
40
41 assert -54 div 5 = -11
42
43 assert -54 mod 5 = 1
44
45 assert -(54 div 5) = -10
46
47 assert -(54 mod 5) = -4
48
49 assert 3 * 18 div 5 = 10
50
51 assert 3 * (18 div 5) = 9
52
53 assert 3 * 18 mod 5 = 4
54
55 assert 3 * (18 mod 5) = 9
56
57 assert 54 div 5 * 3 = 30
58
59 assert 54 div (5 * 3) = 3
60
61 assert 54 mod 5 * 3 = 12
62
63 assert 54 mod (5 * 3) = 9
64
65 assert 3 - 8 + 7 = 2
66
67 assert 3 - (8 + 7) = -12
68
69 assert 3 + 8 * 7 = 59
70
71 assert (3 + 8) * 7 = 77
72
73 assert 3 + - (2 ^ 4) = -13
74
75 assert 3 + 5 / 2 + 3 = 8.5
76
77 assert (3 + 5) / (2 + 3) = 1.6
78
79 assert ( 5 + 6 = 10 ) = 0
80
81 assert ( 5 + 6 = 11 ) = 1
82
83 assert ( 5 + 6 <> 10 ) = 1
84
85 assert ( 5 + 6 <> 11 ) = 0
86
87 assert ( 5 + 6 < 10 ) = 0
88
89 assert ( 5 + 6 < 11 ) = 0
90
91 assert ( 5 + 6 > 10 ) = 1
92
93 assert ( 5 + 6 > 11 ) = 0
94
95 assert ( 5 + 6 <= 10 ) = 0
96
97 assert ( 5 + 6 <= 11 ) = 1
98
99 assert ( 5 + 6 >= 10 ) = 1
100
101 assert ( 5 + 6 >= 11 ) = 1
102
103 assert ( not 5 + 6 = 10 ) = 1
104
105 x = 7
106 assert ( x > 5 and x < 10 ) = 1
107 assert ( not x <= 5 and not x >= 10 ) = 1
108 assert ( not (x <= 5 or x >= 10) ) = 1
109 x = 3
110 assert ( x > 5 and x < 10 ) = 0
111 assert ( not x <= 5 and not x >= 10 ) = 0
112 assert ( not (x <= 5 or x >= 10) ) = 0
113 x = 11
114 assert ( x > 5 and x < 10 ) = 0
115 assert ( not x <= 5 and not x >= 10 ) = 0
116 assert ( not (x <= 5 or x >= 10) ) = 0
117 x = undefined
118 assert ( x > 5 and x < 10 ) = 0
119 assert ( not x <= 5 and not x >= 10 ) = 1
120 assert ( not (x <= 5 or x >= 10) ) = 1
121
122 string$ = "hallo"
123 length = length (string$ + "dag")
124 assert length = 8
125
126 head$ = left$ ("hallo", 3)
127 assert head$ = "hal"
128
129 english$ = "he" + right$ ("hallo", 3)
130 assert english$ = "hello"
131
132 assert mid$ ("hello", 3, 2) = "ll"
133
134 where = index ("hallo allemaal", "al")
135 assert where = 2
136 assert index ("hallo allemaal", "fhjgfhj") = 0
137
138 where = rindex ("hallo allemaal", "al")
139 assert where = 13
140 assert rindex ("hallo allemaal", "fhjgfhj") = 0
141
142 where = startsWith ("internationalization", "int")
143 assert where = 1
144
145 where = endsWith ("internationalization", "nation")
146 assert where = 0
147
148 string$ = "5e6"
149 assert 3 + number (string$) = 5000003
150
151 appendInfoLine: "fon/manual_formulas.cpp.praat", " OK"