reformatted some of unit test standards to allow them to work when OpenSim is built in Visual Studio

0.6.0-stable
Dahlia Trimble 2008-09-06 00:58:56 +00:00
parent 4d86a324f8
commit 88cdd266ef
1 changed files with 159 additions and 174 deletions

View File

@ -78,14 +78,13 @@ state another_state
}
}
";
string expected = @"
public void default_event_state_entry()
{
}
public void another_state_event_no_sensor()
{
}
";
string expected =
"\n public void default_event_state_entry()" +
"\n {" +
"\n }" +
"\n public void another_state_event_no_sensor()" +
"\n {" +
"\n }\n";
CSCodeGenerator cg = new CSCodeGenerator();
string output = cg.Convert(input);
@ -102,11 +101,10 @@ state another_state
}
}
";
string expected = @"
public void default_event_at_rot_target(LSL_Types.LSLInteger tnum, LSL_Types.Quaternion targetrot, LSL_Types.Quaternion ourrot)
{
}
";
string expected =
"\n public void default_event_at_rot_target(LSL_Types.LSLInteger tnum, LSL_Types.Quaternion targetrot, LSL_Types.Quaternion ourrot)" +
"\n {" +
"\n }\n";
CSCodeGenerator cg = new CSCodeGenerator();
string output = cg.Convert(input);
@ -124,12 +122,11 @@ state another_state
}
}
";
string expected = @"
public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
{
LSL_Types.LSLInteger x = 0;
}
";
string expected =
"\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" +
"\n {" +
"\n LSL_Types.LSLInteger x = 0;" +
"\n }\n";
CSCodeGenerator cg = new CSCodeGenerator();
string output = cg.Convert(input);
@ -149,14 +146,13 @@ state another_state
}
}
";
string expected = @"
public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
{
LSL_Types.LSLString y = """";
LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(14);
y = new LSL_Types.LSLString(""Hello"");
}
";
string expected =
"\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" +
"\n {" +
"\n LSL_Types.LSLString y = \"\";" +
"\n LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(14);" +
"\n y = new LSL_Types.LSLString(\"Hello\");" +
"\n }\n";
CSCodeGenerator cg = new CSCodeGenerator();
string output = cg.Convert(input);
@ -177,15 +173,14 @@ state another_state
}
}
";
string expected = @"
public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
{
LSL_Types.LSLInteger y = -new LSL_Types.LSLInteger(3);
LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(14) + new LSL_Types.LSLInteger(6);
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;
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;
}
";
string expected =
"\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)\n" +
" {\n" +
" LSL_Types.LSLInteger y = -new LSL_Types.LSLInteger(3);\n" +
" LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(14) + new LSL_Types.LSLInteger(6);\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;\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;\n" +
" }\n";
CSCodeGenerator cg = new CSCodeGenerator();
string output = cg.Convert(input);
@ -205,14 +200,14 @@ state another_state
}
}
";
string expected = @"
public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
{
llOwnerSay(new LSL_Types.LSLString(""Testing, 1, 2, 3""));
llSay(new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(""I can hear you!""));
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""));
}
";
string expected =
"\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" +
"\n {" +
"\n llOwnerSay(new LSL_Types.LSLString(\"Testing, 1, 2, 3\"));" +
"\n llSay(new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(\"I can hear you!\"));" +
"\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\"));" +
"\n }" +
"\n";
CSCodeGenerator cg = new CSCodeGenerator();
string output = cg.Convert(input);
@ -238,20 +233,19 @@ state another_state
}
}
";
string expected = @"
public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
{
LSL_Types.LSLInteger y = 0;
LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(14) + new LSL_Types.LSLInteger(6);
y = new LSL_Types.LSLInteger(12) - new LSL_Types.LSLInteger(3);
y = new LSL_Types.LSLInteger(12) * new LSL_Types.LSLInteger(3);
y = new LSL_Types.LSLInteger(12) / new LSL_Types.LSLInteger(3);
y = new LSL_Types.LSLInteger(12) | new LSL_Types.LSLInteger(3);
y = new LSL_Types.LSLInteger(12) & new LSL_Types.LSLInteger(3);
y = new LSL_Types.LSLInteger(12) % new LSL_Types.LSLInteger(3);
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;
}
";
string expected =
"\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" +
"\n {" +
"\n LSL_Types.LSLInteger y = 0;" +
"\n LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(14) + new LSL_Types.LSLInteger(6);" +
"\n y = new LSL_Types.LSLInteger(12) - new LSL_Types.LSLInteger(3);" +
"\n y = new LSL_Types.LSLInteger(12) * new LSL_Types.LSLInteger(3);" +
"\n y = new LSL_Types.LSLInteger(12) / new LSL_Types.LSLInteger(3);" +
"\n y = new LSL_Types.LSLInteger(12) | new LSL_Types.LSLInteger(3);" +
"\n y = new LSL_Types.LSLInteger(12) & new LSL_Types.LSLInteger(3);" +
"\n y = new LSL_Types.LSLInteger(12) % new LSL_Types.LSLInteger(3);" +
"\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;" +
"\n }\n";
CSCodeGenerator cg = new CSCodeGenerator();
string output = cg.Convert(input);
@ -284,27 +278,26 @@ state another_state
}
}
";
string expected = @"
public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
{
LSL_Types.LSLFloat y = new LSL_Types.LSLFloat(1.1);
y = new LSL_Types.LSLFloat(1.123E3);
y = new LSL_Types.LSLFloat(1.123e3);
y = new LSL_Types.LSLFloat(1.123E+3);
y = new LSL_Types.LSLFloat(1.123e+3);
y = new LSL_Types.LSLFloat(1.123E-3);
y = new LSL_Types.LSLFloat(1.123e-3);
y = new LSL_Types.LSLFloat(.4);
y = -new LSL_Types.LSLFloat(1.123E3);
y = -new LSL_Types.LSLFloat(1.123e3);
y = -new LSL_Types.LSLFloat(1.123E+3);
y = -new LSL_Types.LSLFloat(1.123e+3);
y = -new LSL_Types.LSLFloat(1.123E-3);
y = -new LSL_Types.LSLFloat(1.123e-3);
y = -new LSL_Types.LSLFloat(.4);
y = new LSL_Types.LSLFloat(12.3) + -new LSL_Types.LSLFloat(1.45E3) - new LSL_Types.LSLFloat(1.20e-2);
}
";
string expected =
"\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" +
"\n {" +
"\n LSL_Types.LSLFloat y = new LSL_Types.LSLFloat(1.1);" +
"\n y = new LSL_Types.LSLFloat(1.123E3);" +
"\n y = new LSL_Types.LSLFloat(1.123e3);" +
"\n y = new LSL_Types.LSLFloat(1.123E+3);" +
"\n y = new LSL_Types.LSLFloat(1.123e+3);" +
"\n y = new LSL_Types.LSLFloat(1.123E-3);" +
"\n y = new LSL_Types.LSLFloat(1.123e-3);" +
"\n y = new LSL_Types.LSLFloat(.4);" +
"\n y = -new LSL_Types.LSLFloat(1.123E3);" +
"\n y = -new LSL_Types.LSLFloat(1.123e3);" +
"\n y = -new LSL_Types.LSLFloat(1.123E+3);" +
"\n y = -new LSL_Types.LSLFloat(1.123e+3);" +
"\n y = -new LSL_Types.LSLFloat(1.123E-3);" +
"\n y = -new LSL_Types.LSLFloat(1.123e-3);" +
"\n y = -new LSL_Types.LSLFloat(.4);" +
"\n y = new LSL_Types.LSLFloat(12.3) + -new LSL_Types.LSLFloat(1.45E3) - new LSL_Types.LSLFloat(1.20e-2);" +
"\n }\n";
CSCodeGenerator cg = new CSCodeGenerator();
string output = cg.Convert(input);
@ -323,11 +316,10 @@ default
}
}
";
string expected = @"
public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
{
}
";
string expected =
"\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" +
"\n {" +
"\n }\n";
CSCodeGenerator cg = new CSCodeGenerator();
string output = cg.Convert(input);
@ -357,16 +349,15 @@ default
}
}
";
string expected = @"
public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
{
LSL_Types.LSLString s1 = new LSL_Types.LSLString(""this is a string."");
LSL_Types.LSLString s2 = new LSL_Types.LSLString(""this is a string "") + new LSL_Types.LSLString(""with an escaped \"" inside it."");
s1 = s2 + new LSL_Types.LSLString("" and this "") + new LSL_Types.LSLString(""is a string with // comments."");
LSL_Types.LSLString onemore = new LSL_Types.LSLString(""[\^@]"");
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."");
}
";
string expected =
"\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" +
"\n {" +
"\n LSL_Types.LSLString s1 = new LSL_Types.LSLString(\"this is a string.\");" +
"\n LSL_Types.LSLString s2 = new LSL_Types.LSLString(\"this is a string \") + new LSL_Types.LSLString(\"with an escaped \\\" inside it.\");" +
"\n s1 = s2 + new LSL_Types.LSLString(\" and this \") + new LSL_Types.LSLString(\"is a string with // comments.\");" +
"\n LSL_Types.LSLString onemore = new LSL_Types.LSLString(\"[^@]\");" +
"\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.\");" +
"\n }\n";
CSCodeGenerator cg = new CSCodeGenerator();
string output = cg.Convert(input);
@ -397,21 +388,20 @@ default
}
}
";
string expected = @"
LSL_Types.LSLString onefunc()
{
return new LSL_Types.LSLString(""Hi from onefunc()!"");
}
void twofunc(LSL_Types.LSLString s)
{
llSay(new LSL_Types.LSLInteger(1000), s);
}
public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
{
llSay(new LSL_Types.LSLInteger(2000), onefunc());
twofunc();
}
";
string expected =
"\n LSL_Types.LSLString onefunc()" +
"\n {" +
"\n return new LSL_Types.LSLString(\"Hi from onefunc()!\");" +
"\n }" +
"\n void twofunc(LSL_Types.LSLString s)" +
"\n {" +
"\n llSay(new LSL_Types.LSLInteger(1000), s);" +
"\n }" +
"\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" +
"\n {" +
"\n llSay(new LSL_Types.LSLInteger(2000), onefunc());" +
"\n twofunc();" +
"\n }\n";
CSCodeGenerator cg = new CSCodeGenerator();
string output = cg.Convert(input);
@ -449,25 +439,24 @@ default
}
}
";
string expected = @"
LSL_Types.LSLString globalString = """";
LSL_Types.LSLInteger globalInt = new LSL_Types.LSLInteger(14);
LSL_Types.LSLInteger anotherGlobal = new LSL_Types.LSLInteger(20) * globalInt;
LSL_Types.LSLString onefunc()
{
globalString = new LSL_Types.LSLString("" ...and the global!"");
return new LSL_Types.LSLString(""Hi "") + new LSL_Types.LSLString(""from "") + new LSL_Types.LSLString(""onefunc()!"") + globalString;
}
void twofunc(LSL_Types.LSLString s)
{
llSay(new LSL_Types.LSLInteger(1000), s);
}
public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
{
llSay(new LSL_Types.LSLInteger(2000), onefunc());
twofunc();
}
";
string expected =
"\n LSL_Types.LSLString globalString = \"\";" +
"\n LSL_Types.LSLInteger globalInt = new LSL_Types.LSLInteger(14);" +
"\n LSL_Types.LSLInteger anotherGlobal = new LSL_Types.LSLInteger(20) * globalInt;" +
"\n LSL_Types.LSLString onefunc()" +
"\n {" +
"\n globalString = new LSL_Types.LSLString(\" ...and the global!\");" +
"\n return new LSL_Types.LSLString(\"Hi \") + new LSL_Types.LSLString(\"from \") + new LSL_Types.LSLString(\"onefunc()!\") + globalString;" +
"\n }" +
"\n void twofunc(LSL_Types.LSLString s)" +
"\n {" +
"\n llSay(new LSL_Types.LSLInteger(1000), s);" +
"\n }" +
"\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" +
"\n {" +
"\n llSay(new LSL_Types.LSLInteger(2000), onefunc());" +
"\n twofunc();" +
"\n }\n";
CSCodeGenerator cg = new CSCodeGenerator();
string output = cg.Convert(input);
@ -505,24 +494,23 @@ default
}
}
";
string expected = @"
LSL_Types.LSLString globalString = """";
LSL_Types.LSLInteger globalInt = new LSL_Types.LSLInteger(14);
LSL_Types.LSLString onefunc(LSL_Types.LSLString addition)
{
globalInt -= new LSL_Types.LSLInteger(2);
globalString += addition;
return new LSL_Types.LSLString(""Hi "") + new LSL_Types.LSLString(""from "") + new LSL_Types.LSLString(""onefunc()! "") + globalString;
}
public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
{
llSay(new LSL_Types.LSLInteger(2000), onefunc());
LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(2);
x *= new LSL_Types.LSLInteger(3);
x /= new LSL_Types.LSLInteger(14) + -new LSL_Types.LSLInteger(2);
x %= new LSL_Types.LSLInteger(10);
}
";
string expected =
"\n LSL_Types.LSLString globalString = \"\";" +
"\n LSL_Types.LSLInteger globalInt = new LSL_Types.LSLInteger(14);" +
"\n LSL_Types.LSLString onefunc(LSL_Types.LSLString addition)" +
"\n {" +
"\n globalInt -= new LSL_Types.LSLInteger(2);" +
"\n globalString += addition;" +
"\n return new LSL_Types.LSLString(\"Hi \") + new LSL_Types.LSLString(\"from \") + new LSL_Types.LSLString(\"onefunc()! \") + globalString;" +
"\n }" +
"\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" +
"\n {" +
"\n llSay(new LSL_Types.LSLInteger(2000), onefunc());" +
"\n LSL_Types.LSLInteger x = new LSL_Types.LSLInteger(2);" +
"\n x *= new LSL_Types.LSLInteger(3);" +
"\n x /= new LSL_Types.LSLInteger(14) + -new LSL_Types.LSLInteger(2);" +
"\n x %= new LSL_Types.LSLInteger(10);" +
"\n }\n";
CSCodeGenerator cg = new CSCodeGenerator();
string output = cg.Convert(input);
@ -543,14 +531,13 @@ default
}
}
";
string expected = @"
public void default_event_touch_start(LSL_Types.LSLInteger num_detected)
{
LSL_Types.Vector3 y = new LSL_Types.Vector3(new LSL_Types.LSLFloat(1.2), llGetMeAFloat(), new LSL_Types.LSLFloat(4.4));
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));
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));
}
";
string expected =
"\n public void default_event_touch_start(LSL_Types.LSLInteger num_detected)" +
"\n {" +
"\n LSL_Types.Vector3 y = new LSL_Types.Vector3(new LSL_Types.LSLFloat(1.2), llGetMeAFloat(), new LSL_Types.LSLFloat(4.4));" +
"\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));" +
"\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));" +
"\n }\n";
CSCodeGenerator cg = new CSCodeGenerator();
string output = cg.Convert(input);
@ -1538,19 +1525,18 @@ default
}
}";
string expected = @"
public void default_event_state_entry()
{
LSL_Types.LSLInteger x = 0;
while (x = new LSL_Types.LSLInteger(14))
llOwnerSay(new LSL_Types.LSLString(""x is: "") + (LSL_Types.LSLString) (x));
if (x = new LSL_Types.LSLInteger(24))
llOwnerSay(new LSL_Types.LSLString(""x is: "") + (LSL_Types.LSLString) (x));
do
llOwnerSay(new LSL_Types.LSLString(""x is: "") + (LSL_Types.LSLString) (x));
while (x = new LSL_Types.LSLInteger(44));
}
";
string expected =
"\n public void default_event_state_entry()" +
"\n {" +
"\n LSL_Types.LSLInteger x = 0;" +
"\n while (x = new LSL_Types.LSLInteger(14))" +
"\n llOwnerSay(new LSL_Types.LSLString(\"x is: \") + (LSL_Types.LSLString) (x));" +
"\n if (x = new LSL_Types.LSLInteger(24))" +
"\n llOwnerSay(new LSL_Types.LSLString(\"x is: \") + (LSL_Types.LSLString) (x));" +
"\n do" +
"\n llOwnerSay(new LSL_Types.LSLString(\"x is: \") + (LSL_Types.LSLString) (x));" +
"\n while (x = new LSL_Types.LSLInteger(44));" +
"\n }\n";
CSCodeGenerator cg = new CSCodeGenerator();
string output = cg.Convert(input);
@ -1569,13 +1555,12 @@ default
}
}";
string expected = @"
public void default_event_state_entry()
{
LSL_Types.list l = new LSL_Types.list(new LSL_Types.LSLString(""hello""));
l = (l = new LSL_Types.list()) + l + new LSL_Types.LSLString(""world"");
}
";
string expected =
"\n public void default_event_state_entry()" +
"\n {" +
"\n LSL_Types.list l = new LSL_Types.list(new LSL_Types.LSLString(\"hello\"));" +
"\n l = (l = new LSL_Types.list()) + l + new LSL_Types.LSLString(\"world\");" +
"\n }\n";
CSCodeGenerator cg = new CSCodeGenerator();
string output = cg.Convert(input);