From 1c8f4905735ff7653313f725fea13bf6346d1389 Mon Sep 17 00:00:00 2001 From: Mike Mazur Date: Thu, 31 Jul 2008 00:29:19 +0000 Subject: More LSL_Types implicit/explicit cast changes. Fix issue 1854. --- .../ScriptEngine/Common/LSL_TypesTestLSLFloat.cs | 54 +++++++++++----------- .../ScriptEngine/Shared/LSL_TypesTestLSLFloat.cs | 54 +++++++++++----------- 2 files changed, 54 insertions(+), 54 deletions(-) (limited to 'OpenSim/Tests') diff --git a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs index c2d2a5a..58ca8dd 100644 --- a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs +++ b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs @@ -228,31 +228,31 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests } /// - /// Tests LSLFloat is correctly cast implicitly to integer. + /// Tests LSLFloat is correctly cast explicitly to integer. /// [Test] - public void TestImplicitCastLSLFloatToInt() + public void TestExplicitCastLSLFloatToInt() { int testNumber; foreach (KeyValuePair number in m_doubleIntSet) { - testNumber = new LSL_Types.LSLFloat(number.Key); + testNumber = (int) new LSL_Types.LSLFloat(number.Key); Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting int " + number.Value); } } /// - /// Tests LSLFloat is correctly cast implicitly to unsigned integer. + /// Tests LSLFloat is correctly cast explicitly to unsigned integer. /// [Test] - public void TestImplicitCastLSLFloatToUint() + public void TestExplicitCastLSLFloatToUint() { uint testNumber; foreach (KeyValuePair number in m_doubleUintSet) { - testNumber = new LSL_Types.LSLFloat(number.Key); + testNumber = (uint) new LSL_Types.LSLFloat(number.Key); Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting uint " + number.Value); } } @@ -333,16 +333,16 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests } /// - /// Tests string is correctly cast implicitly to LSLFloat. + /// Tests string is correctly cast explicitly to LSLFloat. /// [Test] - public void TestImplicitCastStringToLSLFloat() + public void TestExplicitCastStringToLSLFloat() { LSL_Types.LSLFloat testFloat; foreach (KeyValuePair number in m_stringDoubleSet) { - testFloat = number.Key; + testFloat = (LSL_Types.LSLFloat) number.Key; Assert.That(testFloat.value, new DoubleToleranceConstraint(number.Value, _lowPrecisionTolerance)); } } @@ -378,6 +378,24 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests } /// + /// Tests LSLFloat is correctly cast implicitly to double. + /// + [Test] + public void TestImplicitCastLSLFloatToDouble() + { + double testNumber; + LSL_Types.LSLFloat testFloat; + + foreach (double number in m_doubleList) + { + testFloat = new LSL_Types.LSLFloat(number); + testNumber = testFloat; + + Assert.That(testNumber, new DoubleToleranceConstraint(number, _lowPrecisionTolerance)); + } + } + + /// /// Tests the equality (==) operator. /// [Test] @@ -464,24 +482,6 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests } /// - /// Tests LSLFloat is correctly cast implicitly to double. - /// - [Test] - public void TestImplicitCastLSLFloatToDouble() - { - double testNumber; - LSL_Types.LSLFloat testFloat; - - foreach (double number in m_doubleList) - { - testFloat = new LSL_Types.LSLFloat(number); - testNumber = testFloat; - - Assert.That(testNumber, new DoubleToleranceConstraint(number, _lowPrecisionTolerance)); - } - } - - /// /// Tests LSLFloat.ToString(). /// [Test] diff --git a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/LSL_TypesTestLSLFloat.cs b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/LSL_TypesTestLSLFloat.cs index 035208b..d55f0e3 100644 --- a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/LSL_TypesTestLSLFloat.cs +++ b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Shared/LSL_TypesTestLSLFloat.cs @@ -228,31 +228,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests } /// - /// Tests LSLFloat is correctly cast implicitly to integer. + /// Tests LSLFloat is correctly cast explicitly to integer. /// [Test] - public void TestImplicitCastLSLFloatToInt() + public void TestExplicitCastLSLFloatToInt() { int testNumber; foreach (KeyValuePair number in m_doubleIntSet) { - testNumber = new LSL_Types.LSLFloat(number.Key); + testNumber = (int) new LSL_Types.LSLFloat(number.Key); Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting int " + number.Value); } } /// - /// Tests LSLFloat is correctly cast implicitly to unsigned integer. + /// Tests LSLFloat is correctly cast explicitly to unsigned integer. /// [Test] - public void TestImplicitCastLSLFloatToUint() + public void TestExplicitCastLSLFloatToUint() { uint testNumber; foreach (KeyValuePair number in m_doubleUintSet) { - testNumber = new LSL_Types.LSLFloat(number.Key); + testNumber = (uint) new LSL_Types.LSLFloat(number.Key); Assert.AreEqual(number.Value, testNumber, "Converting double " + number.Key + ", expecting uint " + number.Value); } } @@ -333,16 +333,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests } /// - /// Tests string is correctly cast implicitly to LSLFloat. + /// Tests string is correctly cast explicitly to LSLFloat. /// [Test] - public void TestImplicitCastStringToLSLFloat() + public void TestExplicitCastStringToLSLFloat() { LSL_Types.LSLFloat testFloat; foreach (KeyValuePair number in m_stringDoubleSet) { - testFloat = number.Key; + testFloat = (LSL_Types.LSLFloat) number.Key; Assert.That(testFloat.value, new DoubleToleranceConstraint(number.Value, _lowPrecisionTolerance)); } } @@ -378,6 +378,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests } /// + /// Tests LSLFloat is correctly cast implicitly to double. + /// + [Test] + public void TestImplicitCastLSLFloatToDouble() + { + double testNumber; + LSL_Types.LSLFloat testFloat; + + foreach (double number in m_doubleList) + { + testFloat = new LSL_Types.LSLFloat(number); + testNumber = testFloat; + + Assert.That(testNumber, new DoubleToleranceConstraint(number, _lowPrecisionTolerance)); + } + } + + /// /// Tests the equality (==) operator. /// [Test] @@ -464,24 +482,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests } /// - /// Tests LSLFloat is correctly cast implicitly to double. - /// - [Test] - public void TestImplicitCastLSLFloatToDouble() - { - double testNumber; - LSL_Types.LSLFloat testFloat; - - foreach (double number in m_doubleList) - { - testFloat = new LSL_Types.LSLFloat(number); - testNumber = testFloat; - - Assert.That(testNumber, new DoubleToleranceConstraint(number, _lowPrecisionTolerance)); - } - } - - /// /// Tests LSLFloat.ToString(). /// [Test] -- cgit v1.1