Replace implicit casts from LSLFloat to int and uint which were removed in

r5487.

Also put the unit tests back for Bamboo to execute them, let's see how this
goes.
0.6.0-stable
Mike Mazur 2008-07-24 05:23:38 +00:00
parent cc5d49d9c1
commit 117cc09edc
4 changed files with 34 additions and 2 deletions

View File

@ -21,7 +21,19 @@
<touch file="../${projectdir}/bin/startup_commands.txt" />
<delete dir="../test-results" />
<mkdir dir="../test-results" />
<nunit2>
<formatter type="Xml" usefile="true" extension=".xml" outputdir="../test-results" />
<test>
<assemblies>
<include name="../bin/OpenSim.Framework.Tests.dll" />
<include name="../bin/OpenSim.Region.ScriptEngine.Common.Tests.dll" />
<include name="../bin/OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests.dll" />
<include name="../bin/OpenSim.Region.Environment.dll" />
</assemblies>
</test>
</nunit2>
<zip zipfile="../${projectdir}.zip">
<fileset basedir="${projectdir}/">

View File

@ -1422,6 +1422,16 @@ namespace OpenSim.Region.ScriptEngine.Common
#region Operators
static public implicit operator int(LSLFloat f)
{
return (int)f.value;
}
static public implicit operator uint(LSLFloat f)
{
return (uint) Math.Abs(f.value);
}
static public implicit operator Boolean(LSLFloat f)
{
if (f.value == 0.0)

View File

@ -1477,6 +1477,16 @@ namespace OpenSim.Region.ScriptEngine.Shared
#region Operators
static public implicit operator int(LSLFloat f)
{
return (int)f.value;
}
static public implicit operator uint(LSLFloat f)
{
return (uint) Math.Abs(f.value);
}
static public implicit operator Boolean(LSLFloat f)
{
if (f.value == 0.0)

View File

@ -133,7 +133,7 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
foreach (KeyValuePair<double, int> number in numberSet)
{
testNumber = (int)(new LSL_Types.LSLFloat(number.Key));
testNumber = new LSL_Types.LSLFloat(number.Key);
Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting int " + number.Value);
}
}
@ -170,7 +170,7 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests
foreach (KeyValuePair<double, int> number in numberSet)
{
testNumber = (uint)(new LSL_Types.LSLFloat(number.Key));
testNumber = new LSL_Types.LSLFloat(number.Key);
Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting uint " + number.Value);
}
}