| 1 |
$ Test program for Aprepro |
| 2 |
$ |
| 3 |
Test number representations |
| 4 |
1 1 1 1 1 |
| 5 |
1 1 1 1 1 |
| 6 |
|
| 7 |
Test assign statements: |
| 8 |
5 5 $ Should print 5 5 |
| 9 |
10 10 $ Should print 10 10 |
| 10 |
5 5 $ Should print 5 5 |
| 11 |
25 25 $ Should print 25 25 |
| 12 |
5 5 $ Should print 5 5 |
| 13 |
3125 3125 $ Should print 3125 3125 |
| 14 |
5 3125 3125 $ Should print 5 3125 3125 |
| 15 |
|
| 16 |
Test trigonometric functions (radians) |
| 17 |
3.141592654 3.141592654 3.141592654 $ Three values of pi |
| 18 |
0.7071067812 4.440892099e-16 $ sin(pi/4) |
| 19 |
0.7071067812 0 $ cos(pi/4) |
| 20 |
1 0 $ tan(pi/4) |
| 21 |
|
| 22 |
Test trigonometric functions (degrees) |
| 23 |
180 180 180 |
| 24 |
0.7071067812 2.842170943e-14 $ sin(180/4) |
| 25 |
0.7071067812 0 $ cos(180/4) |
| 26 |
1 0 $ tan(180/4) |
| 27 |
|
| 28 |
Test max, min, sign, dim, abs |
| 29 |
0.5 -1 $ Should be 0.5, -1 |
| 30 |
1 -0.5 $ Should be 1.0, -0.5 |
| 31 |
0 1 $ Should be 0 1 |
| 32 |
1 0 $ Should be 1 0 |
| 33 |
1 0 $ Should be 1 0 |
| 34 |
|
| 35 |
1 0 |
| 36 |
$ Test ternary... |
| 37 |
correct |
| 38 |
correct |
| 39 |
|
| 40 |
$ Test ifdef lines |
| 41 |
This line should be echoed. (a) |
| 42 |
This line should be echoed. (b) |
| 43 |
This line should be echoed. (c) |
| 44 |
This line should be echoed. (d) |
| 45 |
|
| 46 |
$ Test ifdef - else lines |
| 47 |
This line should be echoed. (1) |
| 48 |
This line should be echoed (4) |
| 49 |
|
| 50 |
$ Test ifndef - else lines |
| 51 |
This line should be echoed (6) |
| 52 |
This line should be echoed. (7) |
| 53 |
$ Lines a, b, c, d, 1, 4, 6, 7 should be echoed |
| 54 |
$ Check line counting -- should be on line 78: |
| 55 |
|
| 56 |
$ ======================================================================== |
| 57 |
$ Test string if lines |
| 58 |
This line should be echoed ("greg") |
| 59 |
|
| 60 |
|
| 61 |
This line should be echoed (empty) |
| 62 |
|
| 63 |
|
| 64 |
$ ======================================================================== |
| 65 |
$ Test if lines |
| 66 |
This line should be echoed. (a) |
| 67 |
This line should be echoed. (b) |
| 68 |
This line should be echoed. (c) |
| 69 |
|
| 70 |
-4.440892099e-16 |
| 71 |
$ Test if - else lines |
| 72 |
complex if works |
| 73 |
|
| 74 |
square roots work |
| 75 |
|
| 76 |
1 2 |
| 77 |
good nested if |
| 78 |
good |
| 79 |
make sure it is still good |
| 80 |
$ ======================================================================== |
| 81 |
$ Test switch |
| 82 |
This should echo |
| 83 |
3.141592654 |
| 84 |
|
| 85 |
|
| 86 |
This should be equal to PI -- 3.141592654 |
| 87 |
$ Test int and [] (shortcut for int) |
| 88 |
5 -5 |
| 89 |
5 -5 |
| 90 |
|
| 91 |
$ Test looping - print sin, cos from 0 to 90 by 5 |
| 92 |
0 0 1 1 |
| 93 |
5 0.08715574275 0.9961946981 1 |
| 94 |
10 0.1736481777 0.984807753 1 |
| 95 |
15 0.2588190451 0.9659258263 1 |
| 96 |
20 0.3420201433 0.9396926208 1 |
| 97 |
25 0.4226182617 0.906307787 1 |
| 98 |
30 0.5 0.8660254038 1 |
| 99 |
35 0.5735764364 0.8191520443 1 |
| 100 |
40 0.6427876097 0.7660444431 1 |
| 101 |
45 0.7071067812 0.7071067812 1 |
| 102 |
50 0.7660444431 0.6427876097 1 |
| 103 |
55 0.8191520443 0.5735764364 1 |
| 104 |
60 0.8660254038 0.5 1 |
| 105 |
65 0.906307787 0.4226182617 1 |
| 106 |
70 0.9396926208 0.3420201433 1 |
| 107 |
75 0.9659258263 0.2588190451 1 |
| 108 |
80 0.984807753 0.1736481777 1 |
| 109 |
85 0.9961946981 0.08715574275 1 |
| 110 |
90 1 6.123233996e-17 1 |
| 111 |
|
| 112 |
$$$$ Test formatting and string concatenation |
| 113 |
%.10g |
| 114 |
1 Using the format %.1g, PI = 3 |
| 115 |
2 Using the format %.2g, PI = 3.1 |
| 116 |
3 Using the format %.3g, PI = 3.14 |
| 117 |
4 Using the format %.4g, PI = 3.142 |
| 118 |
5 Using the format %.5g, PI = 3.1416 |
| 119 |
6 Using the format %.6g, PI = 3.14159 |
| 120 |
7 Using the format %.7g, PI = 3.141593 |
| 121 |
8 Using the format %.8g, PI = 3.1415927 |
| 122 |
9 Using the format %.9g, PI = 3.14159265 |
| 123 |
10 Using the format %.10g, PI = 3.141592654 |
| 124 |
11 Using the format %.11g, PI = 3.1415926536 |
| 125 |
12 Using the format %.12g, PI = 3.14159265359 |
| 126 |
13 Using the format %.13g, PI = 3.14159265359 |
| 127 |
14 Using the format %.14g, PI = 3.1415926535898 |
| 128 |
15 Using the format %.15g, PI = 3.14159265358979 |
| 129 |
16 Using the format %.16g, PI = 3.141592653589793 |
| 130 |
17 Using the format %.17g, PI = 3.1415926535897931 |
| 131 |
18 Using the format %.18g, PI = 3.14159265358979312 |
| 132 |
19 Using the format %.19g, PI = 3.141592653589793116 |
| 133 |
20 Using the format %.20g, PI = 3.141592653589793116 |
| 134 |
Reset format to default: %.10g |
| 135 |
|
| 136 |
$$$$ Test string rescanning and executing |
| 137 |
|
| 138 |
Original String: |
| 139 |
This is line 1: {a = atan2(0,-1)} |
| 140 |
This is line 2: {sin(a/4)} |
| 141 |
This is line 3: {cos(a/4)} |
| 142 |
Rescanned String: |
| 143 |
This is line 1: 3.141592654 |
| 144 |
This is line 2: 0.7071067812 |
| 145 |
This is line 3: 0.7071067812 |
| 146 |
Original String: |
| 147 |
This has an embedded string: {T = "This is a string"} |
| 148 |
Print Value of variable T = 0 |
| 149 |
Rescanned String: |
| 150 |
This has an embedded string: This is a string |
| 151 |
Print Value of variable T = This is a string |
| 152 |
|
| 153 |
Original String: atan2(0,-1) |
| 154 |
Executed String: 3.141592654 |
| 155 |
|
| 156 |
string = one two, three |
| 157 |
delimiter " ," |
| 158 |
word count = 3 |
| 159 |
second word = "two" |
| 160 |
|
| 161 |
string = (one two, three * four - five |
| 162 |
delimiter " ,(*-" |
| 163 |
word count = 5 |
| 164 |
second word = "two" |
| 165 |
|
| 166 |
|
| 167 |
string = one two, three |
| 168 |
delimiter " ," |
| 169 |
word count = 3 |
| 170 |
|
| 171 |
word 1 = "one" |
| 172 |
word 2 = "two" |
| 173 |
word 3 = "three" |
| 174 |
|
| 175 |
$ Check parsing of escaped braces... |
| 176 |
{ int a = b + 1.570796327 } |
| 177 |
{ } |
| 178 |
|
| 179 |
$ Test variable deletion |
| 180 |
2.449489743 |
| 181 |
2.449489743 |
| 182 |
|
| 183 |
0 This should print warning about undefined variable |
| 184 |
|
| 185 |
$ Test extract |
| 186 |
test string is found |
| 187 |
|
| 188 |
|
| 189 |
$ Test string tokenization optimization |
| 190 |
51,52,53,54,61,62,63,64 |
| 191 |
71,72,73,74,81,82,83,84 |
| 192 |
Word 1 of list1 and list2 are 51 and 71 |
| 193 |
Word 2 of list1 and list2 are 52 and 72 |
| 194 |
Word 3 of list1 and list2 are 53 and 73 |
| 195 |
Word 4 of list1 and list2 are 54 and 74 |
| 196 |
Word 5 of list1 and list2 are 61 and 81 |
| 197 |
Word 6 of list1 and list2 are 62 and 82 |
| 198 |
Word 7 of list1 and list2 are 63 and 83 |
| 199 |
Word 8 of list1 and list2 are 64 and 84 |
| 200 |
|
| 201 |
$End of test file |