diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Tests/Region/ScriptEngine/Shared/CodeTools/CSCodeGeneratorTest.cs | 333 |
1 files changed, 159 insertions, 174 deletions
diff --git a/OpenSim/Tests/Region/ScriptEngine/Shared/CodeTools/CSCodeGeneratorTest.cs b/OpenSim/Tests/Region/ScriptEngine/Shared/CodeTools/CSCodeGeneratorTest.cs index 10dd3fe..3b2a499 100644 --- a/OpenSim/Tests/Region/ScriptEngine/Shared/CodeTools/CSCodeGeneratorTest.cs +++ b/OpenSim/Tests/Region/ScriptEngine/Shared/CodeTools/CSCodeGeneratorTest.cs | |||
@@ -78,14 +78,13 @@ state another_state | |||
78 | } | 78 | } |
79 | } | 79 | } |
80 | "; | 80 | "; |
81 | string expected = @" | 81 | string expected = |
82 | public void default_event_state_entry() | 82 | "\n public void default_event_state_entry()" + |
83 | { | 83 | "\n {" + |
84 | } | 84 | "\n }" + |
85 | public void another_state_event_no_sensor() | 85 | "\n public void another_state_event_no_sensor()" + |
86 | { | 86 | "\n {" + |
87 | } | 87 | "\n }\n"; |
88 | "; | ||
89 | 88 | ||
90 | CSCodeGenerator cg = new CSCodeGenerator(); | 89 | CSCodeGenerator cg = new CSCodeGenerator(); |
91 | string output = cg.Convert(input); | 90 | string output = cg.Convert(input); |
@@ -102,11 +101,10 @@ state another_state | |||
102 | } | 101 | } |
103 | } | 102 | } |
104 | "; | 103 | "; |
105 | string expected = @" | 104 | string expected = |
106 | public void default_event_at_rot_target(LSL_Types.LSLInteger tnum, LSL_Types.Quaternion targetrot, LSL_Types.Quaternion ourrot) | 105 | "\n public void default_event_at_rot_target(LSL_Types.LSLInteger tnum, LSL_Types.Quaternion targetrot, LSL_Types.Quaternion ourrot)" + |
107 | { | 106 | "\n {" + |
108 | } | 107 | "\n }\n"; |
109 | "; | ||
110 | 108 | ||
111 | CSCodeGenerator cg = new CSCodeGenerator(); | 109 | CSCodeGenerator cg = new CSCodeGenerator(); |
112 | string output = cg.Convert(input); | 110 | string output = cg.Convert(input); |
@@ -124,12 +122,11 @@ state another_state | |||
124 | } | 122 | } |
125 | } | 123 | } |
126 | "; | 124 | "; |
127 | string expected = @" | 125 | string expected = |
128 | public void default_event_touch_start(LSL_Types.LSLInteger num_detected) | 126 | "\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" + |
129 | { | 127 | "\n {" + |
130 | LSL_Types.LSLInteger x = 0; | 128 | "\n LSL_Types.LSLInteger x = 0;" + |
131 | } | 129 | "\n }\n"; |
132 | "; | ||
133 | 130 | ||
134 | CSCodeGenerator cg = new CSCodeGenerator(); | 131 | CSCodeGenerator cg = new CSCodeGenerator(); |
135 | string output = cg.Convert(input); | 132 | string output = cg.Convert(input); |
@@ -149,14 +146,13 @@ state another_state | |||
149 | } | 146 | } |
150 | } | 147 | } |
151 | "; | 148 | "; |
152 | string expected = @" | 149 | string expected = |
153 | public void default_event_touch_start(LSL_Types.LSLInteger num_detected) | 150 | "\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" + |
154 | { | 151 | "\n {" + |
155 | LSL_Types.LSLString y = """"; | 152 | "\n LSL_Types.LSLString y = \"\";" + |
156 | LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(14); | 153 | "\n LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(14);" + |
157 | y = new LSL_Types.LSLString(""Hello""); | 154 | "\n y = new LSL_Types.LSLString(\"Hello\");" + |
158 | } | 155 | "\n }\n"; |
159 | "; | ||
160 | 156 | ||
161 | CSCodeGenerator cg = new CSCodeGenerator(); | 157 | CSCodeGenerator cg = new CSCodeGenerator(); |
162 | string output = cg.Convert(input); | 158 | string output = cg.Convert(input); |
@@ -177,15 +173,14 @@ state another_state | |||
177 | } | 173 | } |
178 | } | 174 | } |
179 | "; | 175 | "; |
180 | string expected = @" | 176 | string expected = |
181 | public void default_event_touch_start(LSL_Types.LSLInteger num_detected) | 177 | "\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)\n" + |
182 | { | 178 | " {\n" + |
183 | LSL_Types.LSLInteger y = -new LSL_Types.LSLInteger(3); | 179 | " LSL_Types.LSLInteger y = -new LSL_Types.LSLInteger(3);\n" + |
184 | LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(14) + new LSL_Types.LSLInteger(6); | 180 | " LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(14) + new LSL_Types.LSLInteger(6);\n" + |
185 | y = new LSL_Types.LSLInteger(12) + new LSL_Types.LSLInteger(45) + new LSL_Types.LSLInteger(20) + x + new LSL_Types.LSLInteger(23) + new LSL_Types.LSLInteger(1) + x + y; | 181 | " y = new LSL_Types.LSLInteger(12) + new LSL_Types.LSLInteger(45) + new LSL_Types.LSLInteger(20) + x + new LSL_Types.LSLInteger(23) + new LSL_Types.LSLInteger(1) + x + y;\n" + |
186 | y = new LSL_Types.LSLInteger(12) + -new LSL_Types.LSLInteger(45) + -new LSL_Types.LSLInteger(20) + x + new LSL_Types.LSLInteger(23) + -new LSL_Types.LSLInteger(1) + x + y; | 182 | " y = new LSL_Types.LSLInteger(12) + -new LSL_Types.LSLInteger(45) + -new LSL_Types.LSLInteger(20) + x + new LSL_Types.LSLInteger(23) + -new LSL_Types.LSLInteger(1) + x + y;\n" + |
187 | } | 183 | " }\n"; |
188 | "; | ||
189 | 184 | ||
190 | CSCodeGenerator cg = new CSCodeGenerator(); | 185 | CSCodeGenerator cg = new CSCodeGenerator(); |
191 | string output = cg.Convert(input); | 186 | string output = cg.Convert(input); |
@@ -205,14 +200,14 @@ state another_state | |||
205 | } | 200 | } |
206 | } | 201 | } |
207 | "; | 202 | "; |
208 | string expected = @" | 203 | string expected = |
209 | public void default_event_touch_start(LSL_Types.LSLInteger num_detected) | 204 | "\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" + |
210 | { | 205 | "\n {" + |
211 | llOwnerSay(new LSL_Types.LSLString(""Testing, 1, 2, 3"")); | 206 | "\n llOwnerSay(new LSL_Types.LSLString(\"Testing, 1, 2, 3\"));" + |
212 | llSay(new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(""I can hear you!"")); | 207 | "\n llSay(new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(\"I can hear you!\"));" + |
213 | some_custom_function(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger(2), new LSL_Types.LSLInteger(3) + x, new LSL_Types.LSLInteger(4), new LSL_Types.LSLString(""five""), new LSL_Types.LSLString(""arguments"")); | 208 | "\n some_custom_function(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger(2), new LSL_Types.LSLInteger(3) + x, new LSL_Types.LSLInteger(4), new LSL_Types.LSLString(\"five\"), new LSL_Types.LSLString(\"arguments\"));" + |
214 | } | 209 | "\n }" + |
215 | "; | 210 | "\n"; |
216 | 211 | ||
217 | CSCodeGenerator cg = new CSCodeGenerator(); | 212 | CSCodeGenerator cg = new CSCodeGenerator(); |
218 | string output = cg.Convert(input); | 213 | string output = cg.Convert(input); |
@@ -238,20 +233,19 @@ state another_state | |||
238 | } | 233 | } |
239 | } | 234 | } |
240 | "; | 235 | "; |
241 | string expected = @" | 236 | string expected = |
242 | public void default_event_touch_start(LSL_Types.LSLInteger num_detected) | 237 | "\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" + |
243 | { | 238 | "\n {" + |
244 | LSL_Types.LSLInteger y = 0; | 239 | "\n LSL_Types.LSLInteger y = 0;" + |
245 | LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(14) + new LSL_Types.LSLInteger(6); | 240 | "\n LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(14) + new LSL_Types.LSLInteger(6);" + |
246 | y = new LSL_Types.LSLInteger(12) - new LSL_Types.LSLInteger(3); | 241 | "\n y = new LSL_Types.LSLInteger(12) - new LSL_Types.LSLInteger(3);" + |
247 | y = new LSL_Types.LSLInteger(12) * new LSL_Types.LSLInteger(3); | 242 | "\n y = new LSL_Types.LSLInteger(12) * new LSL_Types.LSLInteger(3);" + |
248 | y = new LSL_Types.LSLInteger(12) / new LSL_Types.LSLInteger(3); | 243 | "\n y = new LSL_Types.LSLInteger(12) / new LSL_Types.LSLInteger(3);" + |
249 | y = new LSL_Types.LSLInteger(12) | new LSL_Types.LSLInteger(3); | 244 | "\n y = new LSL_Types.LSLInteger(12) | new LSL_Types.LSLInteger(3);" + |
250 | y = new LSL_Types.LSLInteger(12) & new LSL_Types.LSLInteger(3); | 245 | "\n y = new LSL_Types.LSLInteger(12) & new LSL_Types.LSLInteger(3);" + |
251 | y = new LSL_Types.LSLInteger(12) % new LSL_Types.LSLInteger(3); | 246 | "\n y = new LSL_Types.LSLInteger(12) % new LSL_Types.LSLInteger(3);" + |
252 | y = new LSL_Types.LSLInteger(12) + new LSL_Types.LSLInteger(45) - new LSL_Types.LSLInteger(20) * x / new LSL_Types.LSLInteger(23) | new LSL_Types.LSLInteger(1) & x + y; | 247 | "\n y = new LSL_Types.LSLInteger(12) + new LSL_Types.LSLInteger(45) - new LSL_Types.LSLInteger(20) * x / new LSL_Types.LSLInteger(23) | new LSL_Types.LSLInteger(1) & x + y;" + |
253 | } | 248 | "\n }\n"; |
254 | "; | ||
255 | 249 | ||
256 | CSCodeGenerator cg = new CSCodeGenerator(); | 250 | CSCodeGenerator cg = new CSCodeGenerator(); |
257 | string output = cg.Convert(input); | 251 | string output = cg.Convert(input); |
@@ -284,27 +278,26 @@ state another_state | |||
284 | } | 278 | } |
285 | } | 279 | } |
286 | "; | 280 | "; |
287 | string expected = @" | 281 | string expected = |
288 | public void default_event_touch_start(LSL_Types.LSLInteger num_detected) | 282 | "\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" + |
289 | { | 283 | "\n {" + |
290 | LSL_Types.LSLFloat y = new LSL_Types.LSLFloat(1.1); | 284 | "\n LSL_Types.LSLFloat y = new LSL_Types.LSLFloat(1.1);" + |
291 | y = new LSL_Types.LSLFloat(1.123E3); | 285 | "\n y = new LSL_Types.LSLFloat(1.123E3);" + |
292 | y = new LSL_Types.LSLFloat(1.123e3); | 286 | "\n y = new LSL_Types.LSLFloat(1.123e3);" + |
293 | y = new LSL_Types.LSLFloat(1.123E+3); | 287 | "\n y = new LSL_Types.LSLFloat(1.123E+3);" + |
294 | y = new LSL_Types.LSLFloat(1.123e+3); | 288 | "\n y = new LSL_Types.LSLFloat(1.123e+3);" + |
295 | y = new LSL_Types.LSLFloat(1.123E-3); | 289 | "\n y = new LSL_Types.LSLFloat(1.123E-3);" + |
296 | y = new LSL_Types.LSLFloat(1.123e-3); | 290 | "\n y = new LSL_Types.LSLFloat(1.123e-3);" + |
297 | y = new LSL_Types.LSLFloat(.4); | 291 | "\n y = new LSL_Types.LSLFloat(.4);" + |
298 | y = -new LSL_Types.LSLFloat(1.123E3); | 292 | "\n y = -new LSL_Types.LSLFloat(1.123E3);" + |
299 | y = -new LSL_Types.LSLFloat(1.123e3); | 293 | "\n y = -new LSL_Types.LSLFloat(1.123e3);" + |
300 | y = -new LSL_Types.LSLFloat(1.123E+3); | 294 | "\n y = -new LSL_Types.LSLFloat(1.123E+3);" + |
301 | y = -new LSL_Types.LSLFloat(1.123e+3); | 295 | "\n y = -new LSL_Types.LSLFloat(1.123e+3);" + |
302 | y = -new LSL_Types.LSLFloat(1.123E-3); | 296 | "\n y = -new LSL_Types.LSLFloat(1.123E-3);" + |
303 | y = -new LSL_Types.LSLFloat(1.123e-3); | 297 | "\n y = -new LSL_Types.LSLFloat(1.123e-3);" + |
304 | y = -new LSL_Types.LSLFloat(.4); | 298 | "\n y = -new LSL_Types.LSLFloat(.4);" + |
305 | y = new LSL_Types.LSLFloat(12.3) + -new LSL_Types.LSLFloat(1.45E3) - new LSL_Types.LSLFloat(1.20e-2); | 299 | "\n y = new LSL_Types.LSLFloat(12.3) + -new LSL_Types.LSLFloat(1.45E3) - new LSL_Types.LSLFloat(1.20e-2);" + |
306 | } | 300 | "\n }\n"; |
307 | "; | ||
308 | 301 | ||
309 | CSCodeGenerator cg = new CSCodeGenerator(); | 302 | CSCodeGenerator cg = new CSCodeGenerator(); |
310 | string output = cg.Convert(input); | 303 | string output = cg.Convert(input); |
@@ -323,11 +316,10 @@ default | |||
323 | } | 316 | } |
324 | } | 317 | } |
325 | "; | 318 | "; |
326 | string expected = @" | 319 | string expected = |
327 | public void default_event_touch_start(LSL_Types.LSLInteger num_detected) | 320 | "\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" + |
328 | { | 321 | "\n {" + |
329 | } | 322 | "\n }\n"; |
330 | "; | ||
331 | 323 | ||
332 | CSCodeGenerator cg = new CSCodeGenerator(); | 324 | CSCodeGenerator cg = new CSCodeGenerator(); |
333 | string output = cg.Convert(input); | 325 | string output = cg.Convert(input); |
@@ -357,16 +349,15 @@ default | |||
357 | } | 349 | } |
358 | } | 350 | } |
359 | "; | 351 | "; |
360 | string expected = @" | 352 | string expected = |
361 | public void default_event_touch_start(LSL_Types.LSLInteger num_detected) | 353 | "\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" + |
362 | { | 354 | "\n {" + |
363 | LSL_Types.LSLString s1 = new LSL_Types.LSLString(""this is a string.""); | 355 | "\n LSL_Types.LSLString s1 = new LSL_Types.LSLString(\"this is a string.\");" + |
364 | LSL_Types.LSLString s2 = new LSL_Types.LSLString(""this is a string "") + new LSL_Types.LSLString(""with an escaped \"" inside it.""); | 356 | "\n LSL_Types.LSLString s2 = new LSL_Types.LSLString(\"this is a string \") + new LSL_Types.LSLString(\"with an escaped \\\" inside it.\");" + |
365 | s1 = s2 + new LSL_Types.LSLString("" and this "") + new LSL_Types.LSLString(""is a string with // comments.""); | 357 | "\n s1 = s2 + new LSL_Types.LSLString(\" and this \") + new LSL_Types.LSLString(\"is a string with // comments.\");" + |
366 | LSL_Types.LSLString onemore = new LSL_Types.LSLString(""[\^@]""); | 358 | "\n LSL_Types.LSLString onemore = new LSL_Types.LSLString(\"[^@]\");" + |
367 | LSL_Types.LSLString multiline = new LSL_Types.LSLString(""Good evening Sir,\n my name is Steve.\n I come from a rough area.\n I used to be addicted to crack\n but now I am off it and trying to stay clean.\n That is why I am selling magazine subscriptions.""); | 359 | "\n LSL_Types.LSLString multiline = new LSL_Types.LSLString(\"Good evening Sir,\n my name is Steve.\n I come from a rough area.\n I used to be addicted to crack\n but now I am off it and trying to stay clean.\n That is why I am selling magazine subscriptions.\");" + |
368 | } | 360 | "\n }\n"; |
369 | "; | ||
370 | 361 | ||
371 | CSCodeGenerator cg = new CSCodeGenerator(); | 362 | CSCodeGenerator cg = new CSCodeGenerator(); |
372 | string output = cg.Convert(input); | 363 | string output = cg.Convert(input); |
@@ -397,21 +388,20 @@ default | |||
397 | } | 388 | } |
398 | } | 389 | } |
399 | "; | 390 | "; |
400 | string expected = @" | 391 | string expected = |
401 | LSL_Types.LSLString onefunc() | 392 | "\n LSL_Types.LSLString onefunc()" + |
402 | { | 393 | "\n {" + |
403 | return new LSL_Types.LSLString(""Hi from onefunc()!""); | 394 | "\n return new LSL_Types.LSLString(\"Hi from onefunc()!\");" + |
404 | } | 395 | "\n }" + |
405 | void twofunc(LSL_Types.LSLString s) | 396 | "\n void twofunc(LSL_Types.LSLString s)" + |
406 | { | 397 | "\n {" + |
407 | llSay(new LSL_Types.LSLInteger(1000), s); | 398 | "\n llSay(new LSL_Types.LSLInteger(1000), s);" + |
408 | } | 399 | "\n }" + |
409 | public void default_event_touch_start(LSL_Types.LSLInteger num_detected) | 400 | "\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" + |
410 | { | 401 | "\n {" + |
411 | llSay(new LSL_Types.LSLInteger(2000), onefunc()); | 402 | "\n llSay(new LSL_Types.LSLInteger(2000), onefunc());" + |
412 | twofunc(); | 403 | "\n twofunc();" + |
413 | } | 404 | "\n }\n"; |
414 | "; | ||
415 | 405 | ||
416 | CSCodeGenerator cg = new CSCodeGenerator(); | 406 | CSCodeGenerator cg = new CSCodeGenerator(); |
417 | string output = cg.Convert(input); | 407 | string output = cg.Convert(input); |
@@ -449,25 +439,24 @@ default | |||
449 | } | 439 | } |
450 | } | 440 | } |
451 | "; | 441 | "; |
452 | string expected = @" | 442 | string expected = |
453 | LSL_Types.LSLString globalString = """"; | 443 | "\n LSL_Types.LSLString globalString = \"\";" + |
454 | LSL_Types.LSLInteger globalInt = new LSL_Types.LSLInteger(14); | 444 | "\n LSL_Types.LSLInteger globalInt = new LSL_Types.LSLInteger(14);" + |
455 | LSL_Types.LSLInteger anotherGlobal = new LSL_Types.LSLInteger(20) * globalInt; | 445 | "\n LSL_Types.LSLInteger anotherGlobal = new LSL_Types.LSLInteger(20) * globalInt;" + |
456 | LSL_Types.LSLString onefunc() | 446 | "\n LSL_Types.LSLString onefunc()" + |
457 | { | 447 | "\n {" + |
458 | globalString = new LSL_Types.LSLString("" ...and the global!""); | 448 | "\n globalString = new LSL_Types.LSLString(\" ...and the global!\");" + |
459 | return new LSL_Types.LSLString(""Hi "") + new LSL_Types.LSLString(""from "") + new LSL_Types.LSLString(""onefunc()!"") + globalString; | 449 | "\n return new LSL_Types.LSLString(\"Hi \") + new LSL_Types.LSLString(\"from \") + new LSL_Types.LSLString(\"onefunc()!\") + globalString;" + |
460 | } | 450 | "\n }" + |
461 | void twofunc(LSL_Types.LSLString s) | 451 | "\n void twofunc(LSL_Types.LSLString s)" + |
462 | { | 452 | "\n {" + |
463 | llSay(new LSL_Types.LSLInteger(1000), s); | 453 | "\n llSay(new LSL_Types.LSLInteger(1000), s);" + |
464 | } | 454 | "\n }" + |
465 | public void default_event_touch_start(LSL_Types.LSLInteger num_detected) | 455 | "\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" + |
466 | { | 456 | "\n {" + |
467 | llSay(new LSL_Types.LSLInteger(2000), onefunc()); | 457 | "\n llSay(new LSL_Types.LSLInteger(2000), onefunc());" + |
468 | twofunc(); | 458 | "\n twofunc();" + |
469 | } | 459 | "\n }\n"; |
470 | "; | ||
471 | 460 | ||
472 | CSCodeGenerator cg = new CSCodeGenerator(); | 461 | CSCodeGenerator cg = new CSCodeGenerator(); |
473 | string output = cg.Convert(input); | 462 | string output = cg.Convert(input); |
@@ -505,24 +494,23 @@ default | |||
505 | } | 494 | } |
506 | } | 495 | } |
507 | "; | 496 | "; |
508 | string expected = @" | 497 | string expected = |
509 | LSL_Types.LSLString globalString = """"; | 498 | "\n LSL_Types.LSLString globalString = \"\";" + |
510 | LSL_Types.LSLInteger globalInt = new LSL_Types.LSLInteger(14); | 499 | "\n LSL_Types.LSLInteger globalInt = new LSL_Types.LSLInteger(14);" + |
511 | LSL_Types.LSLString onefunc(LSL_Types.LSLString addition) | 500 | "\n LSL_Types.LSLString onefunc(LSL_Types.LSLString addition)" + |
512 | { | 501 | "\n {" + |
513 | globalInt -= new LSL_Types.LSLInteger(2); | 502 | "\n globalInt -= new LSL_Types.LSLInteger(2);" + |
514 | globalString += addition; | 503 | "\n globalString += addition;" + |
515 | return new LSL_Types.LSLString(""Hi "") + new LSL_Types.LSLString(""from "") + new LSL_Types.LSLString(""onefunc()! "") + globalString; | 504 | "\n return new LSL_Types.LSLString(\"Hi \") + new LSL_Types.LSLString(\"from \") + new LSL_Types.LSLString(\"onefunc()! \") + globalString;" + |
516 | } | 505 | "\n }" + |
517 | public void default_event_touch_start(LSL_Types.LSLInteger num_detected) | 506 | "\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" + |
518 | { | 507 | "\n {" + |
519 | llSay(new LSL_Types.LSLInteger(2000), onefunc()); | 508 | "\n llSay(new LSL_Types.LSLInteger(2000), onefunc());" + |
520 | LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(2); | 509 | "\n LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(2);" + |
521 | x *= new LSL_Types.LSLInteger(3); | 510 | "\n x *= new LSL_Types.LSLInteger(3);" + |
522 | x /= new LSL_Types.LSLInteger(14) + -new LSL_Types.LSLInteger(2); | 511 | "\n x /= new LSL_Types.LSLInteger(14) + -new LSL_Types.LSLInteger(2);" + |
523 | x %= new LSL_Types.LSLInteger(10); | 512 | "\n x %= new LSL_Types.LSLInteger(10);" + |
524 | } | 513 | "\n }\n"; |
525 | "; | ||
526 | 514 | ||
527 | CSCodeGenerator cg = new CSCodeGenerator(); | 515 | CSCodeGenerator cg = new CSCodeGenerator(); |
528 | string output = cg.Convert(input); | 516 | string output = cg.Convert(input); |
@@ -543,14 +531,13 @@ default | |||
543 | } | 531 | } |
544 | } | 532 | } |
545 | "; | 533 | "; |
546 | string expected = @" | 534 | string expected = |
547 | public void default_event_touch_start(LSL_Types.LSLInteger num_detected) | 535 | "\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" + |
548 | { | 536 | "\n {" + |
549 | LSL_Types.Vector3 y = new LSL_Types.Vector3(new LSL_Types.LSLFloat(1.2), llGetMeAFloat(), new LSL_Types.LSLFloat(4.4)); | 537 | "\n LSL_Types.Vector3 y = new LSL_Types.Vector3(new LSL_Types.LSLFloat(1.2), llGetMeAFloat(), new LSL_Types.LSLFloat(4.4));" + |
550 | LSL_Types.Quaternion x = new LSL_Types.Quaternion(new LSL_Types.LSLFloat(0.1), new LSL_Types.LSLFloat(0.1), one + new LSL_Types.LSLInteger(2), new LSL_Types.LSLFloat(0.9)); | 538 | "\n LSL_Types.Quaternion x = new LSL_Types.Quaternion(new LSL_Types.LSLFloat(0.1), new LSL_Types.LSLFloat(0.1), one + new LSL_Types.LSLInteger(2), new LSL_Types.LSLFloat(0.9));" + |
551 | y = new LSL_Types.Vector3(new LSL_Types.LSLFloat(0.1), new LSL_Types.LSLFloat(0.1), new LSL_Types.LSLFloat(1.1) - three - two + eight * new LSL_Types.LSLInteger(8)); | 539 | "\n y = new LSL_Types.Vector3(new LSL_Types.LSLFloat(0.1), new LSL_Types.LSLFloat(0.1), new LSL_Types.LSLFloat(1.1) - three - two + eight * new LSL_Types.LSLInteger(8));" + |
552 | } | 540 | "\n }\n"; |
553 | "; | ||
554 | 541 | ||
555 | CSCodeGenerator cg = new CSCodeGenerator(); | 542 | CSCodeGenerator cg = new CSCodeGenerator(); |
556 | string output = cg.Convert(input); | 543 | string output = cg.Convert(input); |
@@ -1538,19 +1525,18 @@ default | |||
1538 | } | 1525 | } |
1539 | }"; | 1526 | }"; |
1540 | 1527 | ||
1541 | string expected = @" | 1528 | string expected = |
1542 | public void default_event_state_entry() | 1529 | "\n public void default_event_state_entry()" + |
1543 | { | 1530 | "\n {" + |
1544 | LSL_Types.LSLInteger x = 0; | 1531 | "\n LSL_Types.LSLInteger x = 0;" + |
1545 | while (x = new LSL_Types.LSLInteger(14)) | 1532 | "\n while (x = new LSL_Types.LSLInteger(14))" + |
1546 | llOwnerSay(new LSL_Types.LSLString(""x is: "") + (LSL_Types.LSLString) (x)); | 1533 | "\n llOwnerSay(new LSL_Types.LSLString(\"x is: \") + (LSL_Types.LSLString) (x));" + |
1547 | if (x = new LSL_Types.LSLInteger(24)) | 1534 | "\n if (x = new LSL_Types.LSLInteger(24))" + |
1548 | llOwnerSay(new LSL_Types.LSLString(""x is: "") + (LSL_Types.LSLString) (x)); | 1535 | "\n llOwnerSay(new LSL_Types.LSLString(\"x is: \") + (LSL_Types.LSLString) (x));" + |
1549 | do | 1536 | "\n do" + |
1550 | llOwnerSay(new LSL_Types.LSLString(""x is: "") + (LSL_Types.LSLString) (x)); | 1537 | "\n llOwnerSay(new LSL_Types.LSLString(\"x is: \") + (LSL_Types.LSLString) (x));" + |
1551 | while (x = new LSL_Types.LSLInteger(44)); | 1538 | "\n while (x = new LSL_Types.LSLInteger(44));" + |
1552 | } | 1539 | "\n }\n"; |
1553 | "; | ||
1554 | 1540 | ||
1555 | CSCodeGenerator cg = new CSCodeGenerator(); | 1541 | CSCodeGenerator cg = new CSCodeGenerator(); |
1556 | string output = cg.Convert(input); | 1542 | string output = cg.Convert(input); |
@@ -1569,13 +1555,12 @@ default | |||
1569 | } | 1555 | } |
1570 | }"; | 1556 | }"; |
1571 | 1557 | ||
1572 | string expected = @" | 1558 | string expected = |
1573 | public void default_event_state_entry() | 1559 | "\n public void default_event_state_entry()" + |
1574 | { | 1560 | "\n {" + |
1575 | LSL_Types.list l = new LSL_Types.list(new LSL_Types.LSLString(""hello"")); | 1561 | "\n LSL_Types.list l = new LSL_Types.list(new LSL_Types.LSLString(\"hello\"));" + |
1576 | l = (l = new LSL_Types.list()) + l + new LSL_Types.LSLString(""world""); | 1562 | "\n l = (l = new LSL_Types.list()) + l + new LSL_Types.LSLString(\"world\");" + |
1577 | } | 1563 | "\n }\n"; |
1578 | "; | ||
1579 | 1564 | ||
1580 | CSCodeGenerator cg = new CSCodeGenerator(); | 1565 | CSCodeGenerator cg = new CSCodeGenerator(); |
1581 | string output = cg.Convert(input); | 1566 | string output = cg.Convert(input); |