1
0

Default.lsl 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // autogenerated by generate_default_lsl.rb
  2. integer touch_count = 0;
  3. default {
  4. touch_start(integer total_number) {
  5. float angle45 = PI/4.0; // 45 degrees
  6. float angle30 = PI/6.0; // 30 degrees
  7. float sqrt2 = llSqrt(2.0);
  8. if((llFabs(-1.5) != 1.5) || (llFabs(10.4) != 10.4)) {
  9. llShout(0, "Houston, we have a big problem! llFabs() does not work! Need it for other tests!");
  10. }
  11. llSetText("This is a text by llSetText", <1,0,0>, 1);
  12. llWhisper(0, "llWhispering a few random numbers between 0 and 100: " + llFrand(100) + "," + llFrand(100) + "," + llFrand(100) + "," + llFrand(100));
  13. llShout(0, "llShouting the unix time: " + llGetUnixTime() + ", and region corner: " + llGetRegionCorner());
  14. llShout(1, "Shouting a random number between 0 and 100 on the channel#1: " + llFrand(100));
  15. if (llAbs(-1) != 1) {
  16. llSay(0, "Assert failed: llAbs(-1) != 1");
  17. }
  18. if (llAbs(10) != 10) {
  19. llSay(0, "Assert failed: llAbs(10) != 10");
  20. }
  21. if (llFabs((llCos(angle45) - sqrt2/2.0) - 0) > 0.000001) {
  22. llSay(0, "Assert failed: (llCos(angle45) - sqrt2/2.0) differs from 0 by more than 0.000001");
  23. llSay(0, " --> The actual result: " + (llCos(angle45) - sqrt2/2.0));
  24. }
  25. if (llFabs((llSin(angle30) - 0.5) - 0) > 0.000001) {
  26. llSay(0, "Assert failed: (llSin(angle30) - 0.5) differs from 0 by more than 0.000001");
  27. llSay(0, " --> The actual result: " + (llSin(angle30) - 0.5));
  28. }
  29. if (llFabs((llAtan2(1, 1)*4 - PI) - 0) > 0.000001) {
  30. llSay(0, "Assert failed: (llAtan2(1, 1)*4 - PI) differs from 0 by more than 0.000001");
  31. llSay(0, " --> The actual result: " + (llAtan2(1, 1)*4 - PI));
  32. }
  33. if (llFabs((llTan(PI)) - 0) > 0.000001) {
  34. llSay(0, "Assert failed: (llTan(PI)) differs from 0 by more than 0.000001");
  35. llSay(0, " --> The actual result: " + (llTan(PI)));
  36. }
  37. if (llFloor(2.4) != 2) {
  38. llSay(0, "Assert failed: llFloor(2.4) != 2");
  39. }
  40. if (llCeil(2.4) != 3) {
  41. llSay(0, "Assert failed: llCeil(2.4) != 3");
  42. }
  43. if (llRound(2.4) != 2) {
  44. llSay(0, "Assert failed: llRound(2.4) != 2");
  45. }
  46. if (llFloor(2.5) != 2) {
  47. llSay(0, "Assert failed: llFloor(2.5) != 2");
  48. }
  49. if (llCeil(2.5) != 3) {
  50. llSay(0, "Assert failed: llCeil(2.5) != 3");
  51. }
  52. if (llRound(2.5) != 3) {
  53. llSay(0, "Assert failed: llRound(2.5) != 3");
  54. }
  55. if (llFloor(2.51) != 2) {
  56. llSay(0, "Assert failed: llFloor(2.51) != 2");
  57. }
  58. if (llCeil(2.51) != 3) {
  59. llSay(0, "Assert failed: llCeil(2.51) != 3");
  60. }
  61. if (llRound(2.51) != 3) {
  62. llSay(0, "Assert failed: llRound(2.51) != 3");
  63. }
  64. if (llFloor(3.49) != 3) {
  65. llSay(0, "Assert failed: llFloor(3.49) != 3");
  66. }
  67. if (llCeil(3.49) != 4) {
  68. llSay(0, "Assert failed: llCeil(3.49) != 4");
  69. }
  70. if (llRound(3.49) != 3) {
  71. llSay(0, "Assert failed: llRound(3.49) != 3");
  72. }
  73. if (llFloor(3.5000001) != 3) {
  74. llSay(0, "Assert failed: llFloor(3.5000001) != 3");
  75. }
  76. if (llCeil(3.5000001) != 4) {
  77. llSay(0, "Assert failed: llCeil(3.5000001) != 4");
  78. }
  79. if (llRound(3.5000001) != 4) {
  80. llSay(0, "Assert failed: llRound(3.5000001) != 4");
  81. }
  82. if (llFloor(3.51) != 3) {
  83. llSay(0, "Assert failed: llFloor(3.51) != 3");
  84. }
  85. if (llCeil(3.51) != 4) {
  86. llSay(0, "Assert failed: llCeil(3.51) != 4");
  87. }
  88. if (llRound(3.51) != 4) {
  89. llSay(0, "Assert failed: llRound(3.51) != 4");
  90. }
  91. if ((llFabs(0-llPow(2, 16))) != 65536) {
  92. llSay(0, "Assert failed: (llFabs(0-llPow(2, 16))) != 65536");
  93. }
  94. if (llMD5String("Hello, Avatar!",0) != "112abd47ceaae1c05a826828650434a6") {
  95. llSay(0, "Assert failed: llMD5String('Hello, Avatar!',0) != '112abd47ceaae1c05a826828650434a6'");
  96. }
  97. if (llModPow(2, 16, 37) != 9) {
  98. llSay(0, "Assert failed: llModPow(2, 16, 37) != 9");
  99. }
  100. touch_count++;
  101. llSay(0, "Object was touched. Touch count: " + touch_count);
  102. }
  103. }