aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests
diff options
context:
space:
mode:
authorMelanie Thielker2008-09-02 06:02:14 +0000
committerMelanie Thielker2008-09-02 06:02:14 +0000
commit2fbebbb644397537e3938d9afc3053487c9fa9cf (patch)
tree8a3130426bfc7d4d287651bae1c222ff1760bb21 /OpenSim/Tests
parentCorrect the representation of the automatic null string (diff)
downloadopensim-SC-2fbebbb644397537e3938d9afc3053487c9fa9cf.zip
opensim-SC-2fbebbb644397537e3938d9afc3053487c9fa9cf.tar.gz
opensim-SC-2fbebbb644397537e3938d9afc3053487c9fa9cf.tar.bz2
opensim-SC-2fbebbb644397537e3938d9afc3053487c9fa9cf.tar.xz
First batch of the unit test changes for the new constants semantics
in XEngine. This turned out to be a lot of work to catch up.
Diffstat (limited to 'OpenSim/Tests')
-rw-r--r--OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGeneratorTest.cs178
1 files changed, 89 insertions, 89 deletions
diff --git a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGeneratorTest.cs b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGeneratorTest.cs
index a6b07bf..3c4b9bc 100644
--- a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGeneratorTest.cs
+++ b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGeneratorTest.cs
@@ -153,8 +153,8 @@ state another_state
153 public void default_event_touch_start(LSL_Types.LSLInteger num_detected) 153 public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
154 { 154 {
155 LSL_Types.LSLString y = """"; 155 LSL_Types.LSLString y = """";
156 LSL_Types.LSLInteger x = 14; 156 LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(14);
157 y = ""Hello""; 157 y = new LSL_Types.LSLString(""Hello"");
158 } 158 }
159"; 159";
160 160
@@ -180,10 +180,10 @@ state another_state
180 string expected = @" 180 string expected = @"
181 public void default_event_touch_start(LSL_Types.LSLInteger num_detected) 181 public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
182 { 182 {
183 LSL_Types.LSLInteger y = -3; 183 LSL_Types.LSLInteger y = -new LSL_Types.LSLInteger(3);
184 LSL_Types.LSLInteger x = 14 + 6; 184 LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(14) + new LSL_Types.LSLInteger(6);
185 y = 12 + 45 + 20 + x + 23 + 1 + x + y; 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;
186 y = 12 + -45 + -20 + x + 23 + -1 + x + y; 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;
187 } 187 }
188"; 188";
189 189
@@ -201,16 +201,16 @@ state another_state
201 { 201 {
202 llOwnerSay(""Testing, 1, 2, 3""); 202 llOwnerSay(""Testing, 1, 2, 3"");
203 llSay(0, ""I can hear you!""); 203 llSay(0, ""I can hear you!"");
204 some_custom_function(1, 2, 3 +x, 4, ""five"", ""arguments""); 204 some_custom_function(1, 2, 3 + x, 4, ""five"", ""arguments"");
205 } 205 }
206} 206}
207"; 207";
208 string expected = @" 208 string expected = @"
209 public void default_event_touch_start(LSL_Types.LSLInteger num_detected) 209 public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
210 { 210 {
211 llOwnerSay(""Testing, 1, 2, 3""); 211 llOwnerSay(new LSL_Types.LSLString(""Testing, 1, 2, 3""));
212 llSay(0, ""I can hear you!""); 212 llSay(new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(""I can hear you!""));
213 some_custom_function(1, 2, 3 + x, 4, ""five"", ""arguments""); 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""));
214 } 214 }
215"; 215";
216 216
@@ -242,14 +242,14 @@ state another_state
242 public void default_event_touch_start(LSL_Types.LSLInteger num_detected) 242 public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
243 { 243 {
244 LSL_Types.LSLInteger y = 0; 244 LSL_Types.LSLInteger y = 0;
245 LSL_Types.LSLInteger x = 14 + 6; 245 LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(14) + new LSL_Types.LSLInteger(6);
246 y = 12 - 3; 246 y = new LSL_Types.LSLInteger(12) - new LSL_Types.LSLInteger(3);
247 y = 12 * 3; 247 y = new LSL_Types.LSLInteger(12) * new LSL_Types.LSLInteger(3);
248 y = 12 / 3; 248 y = new LSL_Types.LSLInteger(12) / new LSL_Types.LSLInteger(3);
249 y = 12 | 3; 249 y = new LSL_Types.LSLInteger(12) | new LSL_Types.LSLInteger(3);
250 y = 12 & 3; 250 y = new LSL_Types.LSLInteger(12) & new LSL_Types.LSLInteger(3);
251 y = 12 % 3; 251 y = new LSL_Types.LSLInteger(12) % new LSL_Types.LSLInteger(3);
252 y = 12 + 45 - 20 * x / 23 | 1 & x + y; 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;
253 } 253 }
254"; 254";
255 255
@@ -287,22 +287,22 @@ state another_state
287 string expected = @" 287 string expected = @"
288 public void default_event_touch_start(LSL_Types.LSLInteger num_detected) 288 public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
289 { 289 {
290 LSL_Types.LSLFloat y = 1.1; 290 LSL_Types.LSLFloat y = new LSL_Types.LSLFloat(1.1);
291 y = 1.123E3; 291 y = new LSL_Types.LSLFloat(1.123E3);
292 y = 1.123e3; 292 y = new LSL_Types.LSLFloat(1.123e3);
293 y = 1.123E+3; 293 y = new LSL_Types.LSLFloat(1.123E+3);
294 y = 1.123e+3; 294 y = new LSL_Types.LSLFloat(1.123e+3);
295 y = 1.123E-3; 295 y = new LSL_Types.LSLFloat(1.123E-3);
296 y = 1.123e-3; 296 y = new LSL_Types.LSLFloat(1.123e-3);
297 y = .4; 297 y = new LSL_Types.LSLFloat(.4);
298 y = -1.123E3; 298 y = -new LSL_Types.LSLFloat(1.123E3);
299 y = -1.123e3; 299 y = -new LSL_Types.LSLFloat(1.123e3);
300 y = -1.123E+3; 300 y = -new LSL_Types.LSLFloat(1.123E+3);
301 y = -1.123e+3; 301 y = -new LSL_Types.LSLFloat(1.123e+3);
302 y = -1.123E-3; 302 y = -new LSL_Types.LSLFloat(1.123E-3);
303 y = -1.123e-3; 303 y = -new LSL_Types.LSLFloat(1.123e-3);
304 y = -.4; 304 y = -new LSL_Types.LSLFloat(.4);
305 y = 12.3 + -1.45E3 - 1.20e-2; 305 y = new LSL_Types.LSLFloat(12.3) + -new LSL_Types.LSLFloat(1.45E3) - new LSL_Types.LSLFloat(1.20e-2);
306 } 306 }
307"; 307";
308 308
@@ -360,11 +360,11 @@ default
360 string expected = @" 360 string expected = @"
361 public void default_event_touch_start(LSL_Types.LSLInteger num_detected) 361 public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
362 { 362 {
363 LSL_Types.LSLString s1 = ""this is a string.""; 363 LSL_Types.LSLString s1 = new LSL_Types.LSLString(""this is a string."");
364 LSL_Types.LSLString s2 = ""this is a string "" + ""with an escaped \"" inside it.""; 364 LSL_Types.LSLString s2 = new LSL_Types.LSLString(""this is a string "") + new LSL_Types.LSLString(""with an escaped \"" inside it."");
365 s1 = s2 + "" and this "" + ""is a string with // comments.""; 365 s1 = s2 + new LSL_Types.LSLString("" and this "") + new LSL_Types.LSLString(""is a string with // comments."");
366 LSL_Types.LSLString onemore = ""[\^@]""; 366 LSL_Types.LSLString onemore = new LSL_Types.LSLString(""[\^@]"");
367 LSL_Types.LSLString multiline = ""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.""; 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."");
368 } 368 }
369"; 369";
370 370
@@ -400,15 +400,15 @@ default
400 string expected = @" 400 string expected = @"
401 LSL_Types.LSLString onefunc() 401 LSL_Types.LSLString onefunc()
402 { 402 {
403 return ""Hi from onefunc()!""; 403 return new LSL_Types.LSLString(""Hi from onefunc()!"");
404 } 404 }
405 void twofunc(LSL_Types.LSLString s) 405 void twofunc(LSL_Types.LSLString s)
406 { 406 {
407 llSay(1000, s); 407 llSay(new LSL_Types.LSLInteger(1000), s);
408 } 408 }
409 public void default_event_touch_start(LSL_Types.LSLInteger num_detected) 409 public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
410 { 410 {
411 llSay(2000, onefunc()); 411 llSay(new LSL_Types.LSLInteger(2000), onefunc());
412 twofunc(); 412 twofunc();
413 } 413 }
414"; 414";
@@ -451,20 +451,20 @@ default
451"; 451";
452 string expected = @" 452 string expected = @"
453 LSL_Types.LSLString globalString = """"; 453 LSL_Types.LSLString globalString = """";
454 LSL_Types.LSLInteger globalInt = 14; 454 LSL_Types.LSLInteger globalInt = new LSL_Types.LSLInteger(14);
455 LSL_Types.LSLInteger anotherGlobal = 20 * globalInt; 455 LSL_Types.LSLInteger anotherGlobal = new LSL_Types.LSLInteger(20) * globalInt;
456 LSL_Types.LSLString onefunc() 456 LSL_Types.LSLString onefunc()
457 { 457 {
458 globalString = "" ...and the global!""; 458 globalString = new LSL_Types.LSLString("" ...and the global!"");
459 return ""Hi "" + ""from "" + ""onefunc()!"" + globalString; 459 return new LSL_Types.LSLString(""Hi "") + new LSL_Types.LSLString(""from "") + new LSL_Types.LSLString(""onefunc()!"") + globalString;
460 } 460 }
461 void twofunc(LSL_Types.LSLString s) 461 void twofunc(LSL_Types.LSLString s)
462 { 462 {
463 llSay(1000, s); 463 llSay(new LSL_Types.LSLInteger(1000), s);
464 } 464 }
465 public void default_event_touch_start(LSL_Types.LSLInteger num_detected) 465 public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
466 { 466 {
467 llSay(2000, onefunc()); 467 llSay(new LSL_Types.LSLInteger(2000), onefunc());
468 twofunc(); 468 twofunc();
469 } 469 }
470"; 470";
@@ -507,20 +507,20 @@ default
507"; 507";
508 string expected = @" 508 string expected = @"
509 LSL_Types.LSLString globalString = """"; 509 LSL_Types.LSLString globalString = """";
510 LSL_Types.LSLInteger globalInt = 14; 510 LSL_Types.LSLInteger globalInt = new LSL_Types.LSLInteger(14);
511 LSL_Types.LSLString onefunc(LSL_Types.LSLString addition) 511 LSL_Types.LSLString onefunc(LSL_Types.LSLString addition)
512 { 512 {
513 globalInt -= 2; 513 globalInt -= new LSL_Types.LSLInteger(2);
514 globalString += addition; 514 globalString += addition;
515 return ""Hi "" + ""from "" + ""onefunc()! "" + globalString; 515 return new LSL_Types.LSLString(""Hi "") + new LSL_Types.LSLString(""from "") + new LSL_Types.LSLString(""onefunc()! "") + globalString;
516 } 516 }
517 public void default_event_touch_start(LSL_Types.LSLInteger num_detected) 517 public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
518 { 518 {
519 llSay(2000, onefunc()); 519 llSay(new LSL_Types.LSLInteger(2000), onefunc());
520 LSL_Types.LSLInteger x = 2; 520 LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(2);
521 x *= 3; 521 x *= new LSL_Types.LSLInteger(3);
522 x /= 14 + -2; 522 x /= new LSL_Types.LSLInteger(14) + -new LSL_Types.LSLInteger(2);
523 x %= 10; 523 x %= new LSL_Types.LSLInteger(10);
524 } 524 }
525"; 525";
526 526
@@ -546,9 +546,9 @@ default
546 string expected = @" 546 string expected = @"
547 public void default_event_touch_start(LSL_Types.LSLInteger num_detected) 547 public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
548 { 548 {
549 LSL_Types.Vector3 y = new LSL_Types.Vector3(1.2, llGetMeAFloat(), 4.4); 549 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(0.1, 0.1, one + 2, 0.9); 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));
551 y = new LSL_Types.Vector3(0.1, 0.1, 1.1 - three - two + eight * 8); 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));
552 } 552 }
553"; 553";
554 554
@@ -573,9 +573,9 @@ default
573 string expected = @" 573 string expected = @"
574 public void default_event_touch_start(LSL_Types.LSLInteger num_detected) 574 public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
575 { 575 {
576 LSL_Types.Vector3 y = new LSL_Types.Vector3(1.2, llGetMeAFloat(), 4.4); 576 LSL_Types.Vector3 y = new LSL_Types.Vector3(new LSL_Types.LSLFloat(1.2), llGetMeAFloat(), new LSL_Types.LSLFloat(4.4));
577 x = y.x + 1.1; 577 x = y.x + new LSL_Types.LSLFloat(1.1);
578 y.x = 1.1; 578 y.x = new LSL_Types.LSLFloat(1.1);
579 } 579 }
580"; 580";
581 581
@@ -601,10 +601,10 @@ default
601 string expected = @" 601 string expected = @"
602 public void default_event_touch_start(LSL_Types.LSLInteger num_detected) 602 public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
603 { 603 {
604 LSL_Types.LSLInteger y = -3; 604 LSL_Types.LSLInteger y = -new LSL_Types.LSLInteger(3);
605 LSL_Types.LSLInteger x = 14 + 6; 605 LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(14) + new LSL_Types.LSLInteger(6);
606 y = 12 + 45 + 20 + x + (23 + 1) + x + y; 606 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;
607 y = (12 + -45 + -20 + x + 23) + -1 + x + y; 607 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;
608 } 608 }
609"; 609";
610 610
@@ -632,10 +632,10 @@ default
632 string expected = @" 632 string expected = @"
633 public void default_event_touch_start(LSL_Types.LSLInteger num_detected) 633 public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
634 { 634 {
635 LSL_Types.LSLInteger y = -3; 635 LSL_Types.LSLInteger y = -new LSL_Types.LSLInteger(3);
636 LSL_Types.LSLInteger x = 14 + 6; 636 LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(14) + new LSL_Types.LSLInteger(6);
637 y = 12 + 45 + 20 + x++ + (23 + 1) + ++x + --y; 637 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;
638 y = (12 + -45 + -20 + x-- + 23) + -1 + x-- + ++y; 638 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;
639 } 639 }
640"; 640";
641 641
@@ -721,55 +721,55 @@ default
721 string expected = @" 721 string expected = @"
722 public void default_event_touch_start(LSL_Types.LSLInteger num_detected) 722 public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
723 { 723 {
724 LSL_Types.LSLInteger x = 1; 724 LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(1);
725 if (x) 725 if (x)
726 llSay(0, ""Hello""); 726 llSay(new LSL_Types.LSLInteger(0), ""Hello"");
727 if (1) 727 if (1)
728 { 728 {
729 llSay(0, ""Hi""); 729 llSay(new LSL_Types.LSLInteger(0), ""Hi"");
730 LSL_Types.LSLInteger r = 3; 730 LSL_Types.LSLInteger r = new LSL_Types.LSLInteger(3);
731 return ; 731 return ;
732 } 732 }
733 if (f(x)) 733 if (f(x))
734 llSay(0, ""f(x) is true""); 734 llSay(new LSL_Types.LSLInteger(0), ""f(x) is true"");
735 else 735 else
736 llSay(0, ""f(x) is false""); 736 llSay(new LSL_Types.LSLInteger(0), ""f(x) is false"");
737 if (x + y) 737 if (x + y)
738 llSay(0, ""x + y is true""); 738 llSay(new LSL_Types.LSLInteger(0), ""x + y is true"");
739 else 739 else
740 if (y - x) 740 if (y - x)
741 llSay(0, ""y - x is true""); 741 llSay(new LSL_Types.LSLInteger(0), ""y - x is true"");
742 else 742 else
743 llSay(0, ""Who needs x and y anyway?""); 743 llSay(new LSL_Types.LSLInteger(0), ""Who needs x and y anyway?"");
744 if (x * y) 744 if (x * y)
745 llSay(0, ""x * y is true""); 745 llSay(new LSL_Types.LSLInteger(0), ""x * y is true"");
746 else 746 else
747 if (y / x) 747 if (y / x)
748 { 748 {
749 llSay(0, ""uh-oh, y / x is true, exiting""); 749 llSay(new LSL_Types.LSLInteger(0), ""uh-oh, y / x is true, exiting"");
750 return ; 750 return ;
751 } 751 }
752 else 752 else
753 llSay(0, ""Who needs x and y anyway?""); 753 llSay(new LSL_Types.LSLInteger(0), ""Who needs x and y anyway?"");
754 if (x % y) 754 if (x % y)
755 llSay(0, ""x is true""); 755 llSay(new LSL_Types.LSLInteger(0), ""x is true"");
756 else 756 else
757 if (y & x) 757 if (y & x)
758 llSay(0, ""y is true""); 758 llSay(new LSL_Types.LSLInteger(0), ""y is true"");
759 else 759 else
760 if (z | x) 760 if (z | x)
761 llSay(0, ""z is true""); 761 llSay(new LSL_Types.LSLInteger(0), ""z is true"");
762 else 762 else
763 if (a * (b + x)) 763 if (a * (b + x))
764 llSay(0, ""a is true""); 764 llSay(new LSL_Types.LSLInteger(0), ""a is true"");
765 else 765 else
766 if (b) 766 if (b)
767 llSay(0, ""b is true""); 767 llSay(new LSL_Types.LSLInteger(0), ""b is true"");
768 else 768 else
769 if (v) 769 if (v)
770 llSay(0, ""v is true""); 770 llSay(new LSL_Types.LSLInteger(0), ""v is true"");
771 else 771 else
772 llSay(0, ""Everything is lies!""); 772 llSay(new LSL_Types.LSLInteger(0), ""Everything is lies!"");
773 } 773 }
774"; 774";
775 775