diff options
-rw-r--r-- | .nant/bamboo.build | 12 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 10 | ||||
-rw-r--r-- | OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs | 4 |
4 files changed, 34 insertions, 2 deletions
diff --git a/.nant/bamboo.build b/.nant/bamboo.build index 5577dd9..93e9ad7 100644 --- a/.nant/bamboo.build +++ b/.nant/bamboo.build | |||
@@ -21,7 +21,19 @@ | |||
21 | 21 | ||
22 | <touch file="../${projectdir}/bin/startup_commands.txt" /> | 22 | <touch file="../${projectdir}/bin/startup_commands.txt" /> |
23 | 23 | ||
24 | <delete dir="../test-results" /> | ||
24 | <mkdir dir="../test-results" /> | 25 | <mkdir dir="../test-results" /> |
26 | <nunit2> | ||
27 | <formatter type="Xml" usefile="true" extension=".xml" outputdir="../test-results" /> | ||
28 | <test> | ||
29 | <assemblies> | ||
30 | <include name="../bin/OpenSim.Framework.Tests.dll" /> | ||
31 | <include name="../bin/OpenSim.Region.ScriptEngine.Common.Tests.dll" /> | ||
32 | <include name="../bin/OpenSim.Region.ScriptEngine.Shared.CodeTools.Tests.dll" /> | ||
33 | <include name="../bin/OpenSim.Region.Environment.dll" /> | ||
34 | </assemblies> | ||
35 | </test> | ||
36 | </nunit2> | ||
25 | 37 | ||
26 | <zip zipfile="../${projectdir}.zip"> | 38 | <zip zipfile="../${projectdir}.zip"> |
27 | <fileset basedir="${projectdir}/"> | 39 | <fileset basedir="${projectdir}/"> |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs index be790d6..7274fa5 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | |||
@@ -1422,6 +1422,16 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1422 | 1422 | ||
1423 | #region Operators | 1423 | #region Operators |
1424 | 1424 | ||
1425 | static public implicit operator int(LSLFloat f) | ||
1426 | { | ||
1427 | return (int)f.value; | ||
1428 | } | ||
1429 | |||
1430 | static public implicit operator uint(LSLFloat f) | ||
1431 | { | ||
1432 | return (uint) Math.Abs(f.value); | ||
1433 | } | ||
1434 | |||
1425 | static public implicit operator Boolean(LSLFloat f) | 1435 | static public implicit operator Boolean(LSLFloat f) |
1426 | { | 1436 | { |
1427 | if (f.value == 0.0) | 1437 | if (f.value == 0.0) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 0cddf36..acfe613 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -1477,6 +1477,16 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1477 | 1477 | ||
1478 | #region Operators | 1478 | #region Operators |
1479 | 1479 | ||
1480 | static public implicit operator int(LSLFloat f) | ||
1481 | { | ||
1482 | return (int)f.value; | ||
1483 | } | ||
1484 | |||
1485 | static public implicit operator uint(LSLFloat f) | ||
1486 | { | ||
1487 | return (uint) Math.Abs(f.value); | ||
1488 | } | ||
1489 | |||
1480 | static public implicit operator Boolean(LSLFloat f) | 1490 | static public implicit operator Boolean(LSLFloat f) |
1481 | { | 1491 | { |
1482 | if (f.value == 0.0) | 1492 | if (f.value == 0.0) |
diff --git a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs index 130c0ec..29d0e1c 100644 --- a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs +++ b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs | |||
@@ -133,7 +133,7 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests | |||
133 | 133 | ||
134 | foreach (KeyValuePair<double, int> number in numberSet) | 134 | foreach (KeyValuePair<double, int> number in numberSet) |
135 | { | 135 | { |
136 | testNumber = (int)(new LSL_Types.LSLFloat(number.Key)); | 136 | testNumber = new LSL_Types.LSLFloat(number.Key); |
137 | Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting int " + number.Value); | 137 | Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting int " + number.Value); |
138 | } | 138 | } |
139 | } | 139 | } |
@@ -170,7 +170,7 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests | |||
170 | 170 | ||
171 | foreach (KeyValuePair<double, int> number in numberSet) | 171 | foreach (KeyValuePair<double, int> number in numberSet) |
172 | { | 172 | { |
173 | testNumber = (uint)(new LSL_Types.LSLFloat(number.Key)); | 173 | testNumber = new LSL_Types.LSLFloat(number.Key); |
174 | Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting uint " + number.Value); | 174 | Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting uint " + number.Value); |
175 | } | 175 | } |
176 | } | 176 | } |