aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Region/ScriptEngine
diff options
context:
space:
mode:
authorDahlia Trimble2008-09-06 04:55:05 +0000
committerDahlia Trimble2008-09-06 04:55:05 +0000
commit7d7f57a94d3a1dbdf79dad8f4eed12e2776052b0 (patch)
treeb9bb65e6c6682fa26b2f849d5c66e5f2c7d3d2ce /OpenSim/Tests/Region/ScriptEngine
parentRolling back #6139 because there is no consensus on it's application. (diff)
downloadopensim-SC_OLD-7d7f57a94d3a1dbdf79dad8f4eed12e2776052b0.zip
opensim-SC_OLD-7d7f57a94d3a1dbdf79dad8f4eed12e2776052b0.tar.gz
opensim-SC_OLD-7d7f57a94d3a1dbdf79dad8f4eed12e2776052b0.tar.bz2
opensim-SC_OLD-7d7f57a94d3a1dbdf79dad8f4eed12e2776052b0.tar.xz
more unit test cross-platform compatibility tweaks
Diffstat (limited to 'OpenSim/Tests/Region/ScriptEngine')
-rw-r--r--OpenSim/Tests/Region/ScriptEngine/Shared/CodeTools/CSCodeGeneratorTest.cs409
1 files changed, 195 insertions, 214 deletions
diff --git a/OpenSim/Tests/Region/ScriptEngine/Shared/CodeTools/CSCodeGeneratorTest.cs b/OpenSim/Tests/Region/ScriptEngine/Shared/CodeTools/CSCodeGeneratorTest.cs
index beecdcf..7522f39 100644
--- a/OpenSim/Tests/Region/ScriptEngine/Shared/CodeTools/CSCodeGeneratorTest.cs
+++ b/OpenSim/Tests/Region/ScriptEngine/Shared/CodeTools/CSCodeGeneratorTest.cs
@@ -50,11 +50,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests
50 } 50 }
51} 51}
52"; 52";
53 string expected = @" 53 string expected =
54 public void default_event_state_entry() 54 "\n public void default_event_state_entry()" +
55 { 55 "\n {" +
56 } 56 "\n }\n";
57";
58 57
59 CSCodeGenerator cg = new CSCodeGenerator(); 58 CSCodeGenerator cg = new CSCodeGenerator();
60 string output = cg.Convert(input); 59 string output = cg.Convert(input);
@@ -899,20 +898,19 @@ default
899 } 898 }
900} 899}
901"; 900";
902 string expected = @" 901 string expected =
903 public void default_event_touch_start(LSL_Types.LSLInteger num_detected) 902 "\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" +
904 { 903 "\n {" +
905 LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(1); 904 "\n LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(1);" +
906 LSL_Types.LSLInteger y = new LSL_Types.LSLInteger(0); 905 "\n LSL_Types.LSLInteger y = new LSL_Types.LSLInteger(0);" +
907 while (x) 906 "\n while (x)" +
908 llSay(new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(""To infinity, and beyond!"")); 907 "\n llSay(new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(\"To infinity, and beyond!\"));" +
909 while (new LSL_Types.LSLInteger(0) || (x && new LSL_Types.LSLInteger(0))) 908 "\n while (new LSL_Types.LSLInteger(0) || (x && new LSL_Types.LSLInteger(0)))" +
910 { 909 "\n {" +
911 llSay(new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(""Never say never."")); 910 "\n llSay(new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(\"Never say never.\"));" +
912 return ; 911 "\n return ;" +
913 } 912 "\n }" +
914 } 913 "\n }\n";
915";
916 914
917 CSCodeGenerator cg = new CSCodeGenerator(); 915 CSCodeGenerator cg = new CSCodeGenerator();
918 string output = cg.Convert(input); 916 string output = cg.Convert(input);
@@ -942,22 +940,21 @@ default
942 } 940 }
943} 941}
944"; 942";
945 string expected = @" 943 string expected =
946 public void default_event_touch_start(LSL_Types.LSLInteger num_detected) 944 "\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" +
947 { 945 "\n {" +
948 LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(1); 946 "\n LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(1);" +
949 LSL_Types.LSLInteger y = new LSL_Types.LSLInteger(0); 947 "\n LSL_Types.LSLInteger y = new LSL_Types.LSLInteger(0);" +
950 do 948 "\n do" +
951 llSay(new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(""And we're doing..."")); 949 "\n llSay(new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(\"And we're doing...\"));" +
952 while (x); 950 "\n while (x);" +
953 do 951 "\n do" +
954 { 952 "\n {" +
955 llSay(new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(""I like it here. I wish we could stay here forever."")); 953 "\n llSay(new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(\"I like it here. I wish we could stay here forever.\"));" +
956 y--; 954 "\n y--;" +
957 } 955 "\n }" +
958 while (y); 956 "\n while (y);" +
959 } 957 "\n }\n";
960";
961 958
962 CSCodeGenerator cg = new CSCodeGenerator(); 959 CSCodeGenerator cg = new CSCodeGenerator();
963 string output = cg.Convert(input); 960 string output = cg.Convert(input);
@@ -987,22 +984,21 @@ default
987 } 984 }
988} 985}
989"; 986";
990 string expected = @" 987 string expected =
991 public void default_event_touch_start(LSL_Types.LSLInteger num_detected) 988 "\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" +
992 { 989 "\n {" +
993 LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(1); 990 "\n LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(1);" +
994 LSL_Types.LSLInteger y = new LSL_Types.LSLInteger(0); 991 "\n LSL_Types.LSLInteger y = new LSL_Types.LSLInteger(0);" +
995 for (x = new LSL_Types.LSLInteger(10); x >= new LSL_Types.LSLInteger(0); x--) 992 "\n for (x = new LSL_Types.LSLInteger(10); x >= new LSL_Types.LSLInteger(0); x--)" +
996 { 993 "\n {" +
997 llOwnerSay(new LSL_Types.LSLString(""Launch in T minus "") + x); 994 "\n llOwnerSay(new LSL_Types.LSLString(\"Launch in T minus \") + x);" +
998 IncreaseRocketPower(); 995 "\n IncreaseRocketPower();" +
999 } 996 "\n }" +
1000 for (x = new LSL_Types.LSLInteger(0), y = new LSL_Types.LSLInteger(6); y > new LSL_Types.LSLInteger(0) && x != y; x++, y--) 997 "\n for (x = new LSL_Types.LSLInteger(0), y = new LSL_Types.LSLInteger(6); y > new LSL_Types.LSLInteger(0) && x != y; x++, y--)" +
1001 llOwnerSay(new LSL_Types.LSLString(""Hi "") + x + new LSL_Types.LSLString("", "") + y); 998 "\n llOwnerSay(new LSL_Types.LSLString(\"Hi \") + x + new LSL_Types.LSLString(\", \") + y);" +
1002 for (x = new LSL_Types.LSLInteger(0), y = new LSL_Types.LSLInteger(6); !y; x++, y--) 999 "\n for (x = new LSL_Types.LSLInteger(0), y = new LSL_Types.LSLInteger(6); !y; x++, y--)" +
1003 llOwnerSay(new LSL_Types.LSLString(""Hi "") + x + new LSL_Types.LSLString("", "") + y); 1000 "\n llOwnerSay(new LSL_Types.LSLString(\"Hi \") + x + new LSL_Types.LSLString(\", \") + y);" +
1004 } 1001 "\n }\n";
1005";
1006 1002
1007 CSCodeGenerator cg = new CSCodeGenerator(); 1003 CSCodeGenerator cg = new CSCodeGenerator();
1008 string output = cg.Convert(input); 1004 string output = cg.Convert(input);
@@ -1036,26 +1032,25 @@ default
1036 } 1032 }
1037} 1033}
1038"; 1034";
1039 string expected = @" 1035 string expected =
1040 public void default_event_touch_start(LSL_Types.LSLInteger num_detected) 1036 "\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" +
1041 { 1037 "\n {" +
1042 LSL_Types.LSLFloat y = new LSL_Types.LSLFloat(1.0); 1038 "\n LSL_Types.LSLFloat y = new LSL_Types.LSLFloat(1.0);" +
1043 y = new LSL_Types.LSLFloat(1.0E3); 1039 "\n y = new LSL_Types.LSLFloat(1.0E3);" +
1044 y = new LSL_Types.LSLFloat(1.0e3); 1040 "\n y = new LSL_Types.LSLFloat(1.0e3);" +
1045 y = new LSL_Types.LSLFloat(1.0E+3); 1041 "\n y = new LSL_Types.LSLFloat(1.0E+3);" +
1046 y = new LSL_Types.LSLFloat(1.0e+3); 1042 "\n y = new LSL_Types.LSLFloat(1.0e+3);" +
1047 y = new LSL_Types.LSLFloat(1.0E-3); 1043 "\n y = new LSL_Types.LSLFloat(1.0E-3);" +
1048 y = new LSL_Types.LSLFloat(1.0e-3); 1044 "\n y = new LSL_Types.LSLFloat(1.0e-3);" +
1049 y = -new LSL_Types.LSLFloat(1.0E3); 1045 "\n y = -new LSL_Types.LSLFloat(1.0E3);" +
1050 y = -new LSL_Types.LSLFloat(1.0e3); 1046 "\n y = -new LSL_Types.LSLFloat(1.0e3);" +
1051 y = -new LSL_Types.LSLFloat(1.0E+3); 1047 "\n y = -new LSL_Types.LSLFloat(1.0E+3);" +
1052 y = -new LSL_Types.LSLFloat(1.0e+3); 1048 "\n y = -new LSL_Types.LSLFloat(1.0e+3);" +
1053 y = -new LSL_Types.LSLFloat(1.0E-3); 1049 "\n y = -new LSL_Types.LSLFloat(1.0E-3);" +
1054 y = -new LSL_Types.LSLFloat(1.0e-3); 1050 "\n y = -new LSL_Types.LSLFloat(1.0e-3);" +
1055 y = new LSL_Types.LSLFloat(12.0) + -new LSL_Types.LSLFloat(1.0E3) - new LSL_Types.LSLFloat(1.0e-2); 1051 "\n y = new LSL_Types.LSLFloat(12.0) + -new LSL_Types.LSLFloat(1.0E3) - new LSL_Types.LSLFloat(1.0e-2);" +
1056 LSL_Types.Vector3 v = new LSL_Types.Vector3(new LSL_Types.LSLFloat(0.0), new LSL_Types.LSLFloat(0.0), new LSL_Types.LSLFloat(0.0)); 1052 "\n LSL_Types.Vector3 v = new LSL_Types.Vector3(new LSL_Types.LSLFloat(0.0), new LSL_Types.LSLFloat(0.0), new LSL_Types.LSLFloat(0.0));" +
1057 } 1053 "\n }\n";
1058";
1059 1054
1060 CSCodeGenerator cg = new CSCodeGenerator(); 1055 CSCodeGenerator cg = new CSCodeGenerator();
1061 string output = cg.Convert(input); 1056 string output = cg.Convert(input);
@@ -1081,18 +1076,17 @@ default
1081 } 1076 }
1082} 1077}
1083"; 1078";
1084 string expected = @" 1079 string expected =
1085 public void default_event_touch_start(LSL_Types.LSLInteger num_detected) 1080 "\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" +
1086 { 1081 "\n {" +
1087 LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(2); 1082 "\n LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(2);" +
1088 LSL_Types.LSLInteger y = new LSL_Types.LSLInteger(1); 1083 "\n LSL_Types.LSLInteger y = new LSL_Types.LSLInteger(1);" +
1089 LSL_Types.LSLInteger z = x ^ y; 1084 "\n LSL_Types.LSLInteger z = x ^ y;" +
1090 x = ~z; 1085 "\n x = ~z;" +
1091 x = ~(y && z); 1086 "\n x = ~(y && z);" +
1092 y = x >> z; 1087 "\n y = x >> z;" +
1093 z = y << x; 1088 "\n z = y << x;" +
1094 } 1089 "\n }\n";
1095";
1096 1090
1097 CSCodeGenerator cg = new CSCodeGenerator(); 1091 CSCodeGenerator cg = new CSCodeGenerator();
1098 string output = cg.Convert(input); 1092 string output = cg.Convert(input);
@@ -1123,22 +1117,21 @@ default
1123 } 1117 }
1124} 1118}
1125"; 1119";
1126 string expected = @" 1120 string expected =
1127 public void default_event_touch_start(LSL_Types.LSLInteger num_detected) 1121 "\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" +
1128 { 1122 "\n {" +
1129 LSL_Types.LSLString s = new LSL_Types.LSLString(""""); 1123 "\n LSL_Types.LSLString s = new LSL_Types.LSLString(\"\");" +
1130 LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(1); 1124 "\n LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(1);" +
1131 s = (LSL_Types.LSLString) (x++); 1125 "\n s = (LSL_Types.LSLString) (x++);" +
1132 s = (LSL_Types.LSLString) (x); 1126 "\n s = (LSL_Types.LSLString) (x);" +
1133 s = (LSL_Types.LSLString) (new LSL_Types.Vector3(new LSL_Types.LSLFloat(0.0), new LSL_Types.LSLFloat(0.0), new LSL_Types.LSLFloat(0.0))); 1127 "\n s = (LSL_Types.LSLString) (new LSL_Types.Vector3(new LSL_Types.LSLFloat(0.0), new LSL_Types.LSLFloat(0.0), new LSL_Types.LSLFloat(0.0)));" +
1134 s = (LSL_Types.LSLString) (new LSL_Types.Quaternion(new LSL_Types.LSLFloat(1.0), new LSL_Types.LSLFloat(1.0), new LSL_Types.LSLFloat(1.0), new LSL_Types.LSLFloat(1.0))); 1128 "\n s = (LSL_Types.LSLString) (new LSL_Types.Quaternion(new LSL_Types.LSLFloat(1.0), new LSL_Types.LSLFloat(1.0), new LSL_Types.LSLFloat(1.0), new LSL_Types.LSLFloat(1.0)));" +
1135 s = (LSL_Types.LSLInteger) (new LSL_Types.LSLString(""1"")); 1129 "\n s = (LSL_Types.LSLInteger) (new LSL_Types.LSLString(\"1\"));" +
1136 s = (LSL_Types.LSLString) (llSomethingThatReturnsInteger()); 1130 "\n s = (LSL_Types.LSLString) (llSomethingThatReturnsInteger());" +
1137 s = (LSL_Types.LSLString) (new LSL_Types.LSLInteger(134)); 1131 "\n s = (LSL_Types.LSLString) (new LSL_Types.LSLInteger(134));" +
1138 s = (LSL_Types.LSLString) (x ^ y | (z && l)) + (LSL_Types.LSLString) (x + y - new LSL_Types.LSLInteger(13)); 1132 "\n s = (LSL_Types.LSLString) (x ^ y | (z && l)) + (LSL_Types.LSLString) (x + y - new LSL_Types.LSLInteger(13));" +
1139 llOwnerSay(new LSL_Types.LSLString(""s is: "") + s); 1133 "\n llOwnerSay(new LSL_Types.LSLString(\"s is: \") + s);" +
1140 } 1134 "\n }\n";
1141";
1142 1135
1143 CSCodeGenerator cg = new CSCodeGenerator(); 1136 CSCodeGenerator cg = new CSCodeGenerator();
1144 string output = cg.Convert(input); 1137 string output = cg.Convert(input);
@@ -1168,18 +1161,17 @@ state statetwo
1168 } 1161 }
1169} 1162}
1170"; 1163";
1171 string expected = @" 1164 string expected =
1172 public void default_event_touch_start(LSL_Types.LSLInteger num_detected) 1165 "\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" +
1173 { 1166 "\n {" +
1174 llSay(new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(""Going to state 'statetwo'"")); 1167 "\n llSay(new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(\"Going to state 'statetwo'\"));" +
1175 state(""statetwo""); 1168 "\n state(\"statetwo\");" +
1176 } 1169 "\n }" +
1177 public void statetwo_event_state_entry() 1170 "\n public void statetwo_event_state_entry()" +
1178 { 1171 "\n {" +
1179 llSay(new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(""Going to the default state"")); 1172 "\n llSay(new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(\"Going to the default state\"));" +
1180 state(""default""); 1173 "\n state(\"default\");" +
1181 } 1174 "\n }\n";
1182";
1183 1175
1184 CSCodeGenerator cg = new CSCodeGenerator(); 1176 CSCodeGenerator cg = new CSCodeGenerator();
1185 string output = cg.Convert(input); 1177 string output = cg.Convert(input);
@@ -1203,16 +1195,15 @@ default
1203 } 1195 }
1204} 1196}
1205"; 1197";
1206 string expected = @" 1198 string expected =
1207 public void default_event_touch_start(LSL_Types.LSLInteger num_detected) 1199 "\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" +
1208 { 1200 "\n {" +
1209 LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(0x23); 1201 "\n LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(0x23);" +
1210 LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(0x2f34B); 1202 "\n LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(0x2f34B);" +
1211 LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(0x2F34b); 1203 "\n LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(0x2F34b);" +
1212 LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(0x2F34B); 1204 "\n LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(0x2F34B);" +
1213 LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(0x2f34b); 1205 "\n LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(0x2f34b);" +
1214 } 1206 "\n }\n";
1215";
1216 1207
1217 CSCodeGenerator cg = new CSCodeGenerator(); 1208 CSCodeGenerator cg = new CSCodeGenerator();
1218 string output = cg.Convert(input); 1209 string output = cg.Convert(input);
@@ -1235,15 +1226,14 @@ default
1235 } 1226 }
1236} 1227}
1237"; 1228";
1238 string expected = @" 1229 string expected =
1239 public void default_event_touch_start(LSL_Types.LSLInteger num_detected) 1230 "\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" +
1240 { 1231 "\n {" +
1241 goto here; 1232 "\n goto here;" +
1242 llOwnerSay(new LSL_Types.LSLString(""Uh oh, the jump didn't work"")); 1233 "\n llOwnerSay(new LSL_Types.LSLString(\"Uh oh, the jump didn't work\"));" +
1243 here: 1234 "\n here:" +
1244 llOwnerSay(new LSL_Types.LSLString(""After the jump"")); 1235 "\n llOwnerSay(new LSL_Types.LSLString(\"After the jump\"));" +
1245 } 1236 "\n }\n";
1246";
1247 1237
1248 CSCodeGenerator cg = new CSCodeGenerator(); 1238 CSCodeGenerator cg = new CSCodeGenerator();
1249 string output = cg.Convert(input); 1239 string output = cg.Convert(input);
@@ -1269,25 +1259,24 @@ default
1269 } 1259 }
1270} 1260}
1271"; 1261";
1272 string expected = @" 1262 string expected =
1273 public void default_event_touch_start(LSL_Types.LSLInteger num_detected) 1263 "\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" +
1274 { 1264 "\n {" +
1275 LSL_Types.LSLInteger i = 0; 1265 "\n LSL_Types.LSLInteger i = 0;" +
1276 LSL_Types.LSLInteger j = new LSL_Types.LSLInteger(14); 1266 "\n LSL_Types.LSLInteger j = new LSL_Types.LSLInteger(14);" +
1277 LSL_Types.LSLFloat f = 0.0; 1267 "\n LSL_Types.LSLFloat f = 0.0;" +
1278 LSL_Types.LSLFloat g = new LSL_Types.LSLFloat(14.0); 1268 "\n LSL_Types.LSLFloat g = new LSL_Types.LSLFloat(14.0);" +
1279 LSL_Types.LSLString s = """"; 1269 "\n LSL_Types.LSLString s = \"\";" +
1280 LSL_Types.LSLString t = new LSL_Types.LSLString(""Hi there""); 1270 "\n LSL_Types.LSLString t = new LSL_Types.LSLString(\"Hi there\");" +
1281 LSL_Types.list l = new LSL_Types.list(); 1271 "\n LSL_Types.list l = new LSL_Types.list();" +
1282 LSL_Types.list m = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger(2), new LSL_Types.LSLInteger(3)); 1272 "\n LSL_Types.list m = new LSL_Types.list(new LSL_Types.LSLInteger(1), new LSL_Types.LSLInteger(2), new LSL_Types.LSLInteger(3));" +
1283 LSL_Types.Vector3 v = new LSL_Types.Vector3(0.0, 0.0, 0.0); 1273 "\n LSL_Types.Vector3 v = new LSL_Types.Vector3(0.0, 0.0, 0.0);" +
1284 LSL_Types.Vector3 w = new LSL_Types.Vector3(new LSL_Types.LSLFloat(1.0), new LSL_Types.LSLFloat(0.1), new LSL_Types.LSLFloat(0.5)); 1274 "\n LSL_Types.Vector3 w = new LSL_Types.Vector3(new LSL_Types.LSLFloat(1.0), new LSL_Types.LSLFloat(0.1), new LSL_Types.LSLFloat(0.5));" +
1285 LSL_Types.Quaternion r = new LSL_Types.Quaternion(0.0, 0.0, 0.0, 0.0); 1275 "\n LSL_Types.Quaternion r = new LSL_Types.Quaternion(0.0, 0.0, 0.0, 0.0);" +
1286 LSL_Types.Quaternion u = new LSL_Types.Quaternion(new LSL_Types.LSLFloat(0.8), new LSL_Types.LSLFloat(0.7), new LSL_Types.LSLFloat(0.6), llSomeFunc()); 1276 "\n LSL_Types.Quaternion u = new LSL_Types.Quaternion(new LSL_Types.LSLFloat(0.8), new LSL_Types.LSLFloat(0.7), new LSL_Types.LSLFloat(0.6), llSomeFunc());" +
1287 LSL_Types.LSLString k = """"; 1277 "\n LSL_Types.LSLString k = \"\";" +
1288 LSL_Types.LSLString n = new LSL_Types.LSLString(""ping""); 1278 "\n LSL_Types.LSLString n = new LSL_Types.LSLString(\"ping\");" +
1289 } 1279 "\n }\n";
1290";
1291 1280
1292 CSCodeGenerator cg = new CSCodeGenerator(); 1281 CSCodeGenerator cg = new CSCodeGenerator();
1293 string output = cg.Convert(input); 1282 string output = cg.Convert(input);
@@ -1311,16 +1300,15 @@ default
1311 } 1300 }
1312} 1301}
1313"; 1302";
1314 string expected = @" 1303 string expected =
1315 public void default_event_touch_start(LSL_Types.LSLInteger num_detected) 1304 "\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" +
1316 { 1305 "\n {" +
1317 LSL_Types.LSLInteger x = 0; 1306 "\n LSL_Types.LSLInteger x = 0;" +
1318 LSL_Types.LSLInteger y = 0; 1307 "\n LSL_Types.LSLInteger y = 0;" +
1319 x = y = new LSL_Types.LSLInteger(5); 1308 "\n x = y = new LSL_Types.LSLInteger(5);" +
1320 x += y -= new LSL_Types.LSLInteger(5); 1309 "\n x += y -= new LSL_Types.LSLInteger(5);" +
1321 llOwnerSay(new LSL_Types.LSLString(""x is: "") + (LSL_Types.LSLString) (x) + new LSL_Types.LSLString("", y is: "") + (LSL_Types.LSLString) (y)); 1310 "\n llOwnerSay(new LSL_Types.LSLString(\"x is: \") + (LSL_Types.LSLString) (x) + new LSL_Types.LSLString(\", y is: \") + (LSL_Types.LSLString) (y));" +
1322 } 1311 "\n }\n";
1323";
1324 1312
1325 CSCodeGenerator cg = new CSCodeGenerator(); 1313 CSCodeGenerator cg = new CSCodeGenerator();
1326 string output = cg.Convert(input); 1314 string output = cg.Convert(input);
@@ -1340,12 +1328,11 @@ default
1340 } 1328 }
1341} 1329}
1342"; 1330";
1343 string expected = @" 1331 string expected =
1344 public void default_event_state_entry() 1332 "\n public void default_event_state_entry()" +
1345 { 1333 "\n {" +
1346 LSL_Types.Vector3 v = new LSL_Types.Vector3(x, y, -new LSL_Types.LSLFloat(0.5)); 1334 "\n LSL_Types.Vector3 v = new LSL_Types.Vector3(x, y, -new LSL_Types.LSLFloat(0.5));" +
1347 } 1335 "\n }\n";
1348";
1349 1336
1350 CSCodeGenerator cg = new CSCodeGenerator(); 1337 CSCodeGenerator cg = new CSCodeGenerator();
1351 string output = cg.Convert(input); 1338 string output = cg.Convert(input);
@@ -1370,17 +1357,16 @@ default
1370 } 1357 }
1371} 1358}
1372"; 1359";
1373 string expected = @" 1360 string expected =
1374 public void default_event_state_entry() 1361 "\n public void default_event_state_entry()" +
1375 { 1362 "\n {" +
1376 LSL_Types.Vector3 v = llGetPos(); 1363 "\n LSL_Types.Vector3 v = llGetPos();" +
1377 v.z += new LSL_Types.LSLInteger(4); 1364 "\n v.z += new LSL_Types.LSLInteger(4);" +
1378 v.z -= new LSL_Types.LSLInteger(4); 1365 "\n v.z -= new LSL_Types.LSLInteger(4);" +
1379 v.z *= new LSL_Types.LSLInteger(4); 1366 "\n v.z *= new LSL_Types.LSLInteger(4);" +
1380 v.z /= new LSL_Types.LSLInteger(4); 1367 "\n v.z /= new LSL_Types.LSLInteger(4);" +
1381 v.z %= new LSL_Types.LSLInteger(4); 1368 "\n v.z %= new LSL_Types.LSLInteger(4);" +
1382 } 1369 "\n }\n";
1383";
1384 1370
1385 CSCodeGenerator cg = new CSCodeGenerator(); 1371 CSCodeGenerator cg = new CSCodeGenerator();
1386 string output = cg.Convert(input); 1372 string output = cg.Convert(input);
@@ -1398,13 +1384,12 @@ default
1398 } 1384 }
1399}"; 1385}";
1400 1386
1401 string expected = @" 1387 string expected =
1402 public void default_event_state_entry() 1388 "\n public void default_event_state_entry()" +
1403 { 1389 "\n {" +
1404 while (new LSL_Types.LSLInteger(1) < new LSL_Types.LSLInteger(0)) 1390 "\n while (new LSL_Types.LSLInteger(1) < new LSL_Types.LSLInteger(0))" +
1405 ; 1391 "\n ;" +
1406 } 1392 "\n }\n";
1407";
1408 1393
1409 CSCodeGenerator cg = new CSCodeGenerator(); 1394 CSCodeGenerator cg = new CSCodeGenerator();
1410 string output = cg.Convert(input); 1395 string output = cg.Convert(input);
@@ -1423,14 +1408,13 @@ default
1423 } 1408 }
1424}"; 1409}";
1425 1410
1426 string expected = @" 1411 string expected =
1427 public void default_event_state_entry() 1412 "\n public void default_event_state_entry()" +
1428 { 1413 "\n {" +
1429 do 1414 "\n do" +
1430 ; 1415 "\n ;" +
1431 while (new LSL_Types.LSLInteger(1) < new LSL_Types.LSLInteger(0)); 1416 "\n while (new LSL_Types.LSLInteger(1) < new LSL_Types.LSLInteger(0));" +
1432 } 1417 "\n }\n";
1433";
1434 1418
1435 CSCodeGenerator cg = new CSCodeGenerator(); 1419 CSCodeGenerator cg = new CSCodeGenerator();
1436 string output = cg.Convert(input); 1420 string output = cg.Convert(input);
@@ -1448,13 +1432,12 @@ default
1448 } 1432 }
1449}"; 1433}";
1450 1434
1451 string expected = @" 1435 string expected =
1452 public void default_event_state_entry() 1436 "\n public void default_event_state_entry()" +
1453 { 1437 "\n {" +
1454 if (new LSL_Types.LSLInteger(1) < new LSL_Types.LSLInteger(0)) 1438 "\n if (new LSL_Types.LSLInteger(1) < new LSL_Types.LSLInteger(0))" +
1455 ; 1439 "\n ;" +
1456 } 1440 "\n }\n";
1457";
1458 1441
1459 CSCodeGenerator cg = new CSCodeGenerator(); 1442 CSCodeGenerator cg = new CSCodeGenerator();
1460 string output = cg.Convert(input); 1443 string output = cg.Convert(input);
@@ -1473,15 +1456,14 @@ default
1473 } 1456 }
1474}"; 1457}";
1475 1458
1476 string expected = @" 1459 string expected =
1477 public void default_event_state_entry() 1460 "\n public void default_event_state_entry()" +
1478 { 1461 "\n {" +
1479 if (new LSL_Types.LSLInteger(1) < new LSL_Types.LSLInteger(0)) 1462 "\n if (new LSL_Types.LSLInteger(1) < new LSL_Types.LSLInteger(0))" +
1480 ; 1463 "\n ;" +
1481 else 1464 "\n else" +
1482 ; 1465 "\n ;" +
1483 } 1466 "\n }\n";
1484";
1485 1467
1486 CSCodeGenerator cg = new CSCodeGenerator(); 1468 CSCodeGenerator cg = new CSCodeGenerator();
1487 string output = cg.Convert(input); 1469 string output = cg.Convert(input);
@@ -1499,13 +1481,12 @@ default
1499 } 1481 }
1500}"; 1482}";
1501 1483
1502 string expected = @" 1484 string expected =
1503 public void default_event_state_entry() 1485 "\n public void default_event_state_entry()" +
1504 { 1486 "\n {" +
1505 for (x = new LSL_Types.LSLInteger(4); new LSL_Types.LSLInteger(1) < new LSL_Types.LSLInteger(0); x += new LSL_Types.LSLInteger(2)) 1487 "\n for (x = new LSL_Types.LSLInteger(4); new LSL_Types.LSLInteger(1) < new LSL_Types.LSLInteger(0); x += new LSL_Types.LSLInteger(2))" +
1506 ; 1488 "\n ;" +
1507 } 1489 "\n }\n";
1508";
1509 1490
1510 CSCodeGenerator cg = new CSCodeGenerator(); 1491 CSCodeGenerator cg = new CSCodeGenerator();
1511 string output = cg.Convert(input); 1492 string output = cg.Convert(input);