From 19ad7db5e1ebcce8fc13995270b2ebe94f8a9a52 Mon Sep 17 00:00:00 2001 From: Mike Mazur Date: Fri, 25 Jul 2008 07:50:31 +0000 Subject: Add casts from integer to float. Fix issue 1822. --- .../ScriptEngine/Common/LSL_TypesTestLSLFloat.cs | 32 +++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (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 aba87ac..2d553a7 100644 --- a/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs +++ b/OpenSim/Tests/OpenSim/Region/ScriptEngine/Common/LSL_TypesTestLSLFloat.cs @@ -304,6 +304,36 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests } /// + /// Tests LSLInteger is correctly cast implicitly to LSLFloat. + /// + [Test] + public void TestImplicitCastLSLIntegerToLSLFloat() + { + LSL_Types.LSLFloat testFloat; + + foreach (int number in m_intList) + { + testFloat = new LSL_Types.LSLInteger(number); + Assert.That(testFloat.value, new DoubleToleranceConstraint(number, _lowPrecisionTolerance)); + } + } + + /// + /// Tests LSLInteger is correctly cast explicitly to LSLFloat. + /// + [Test] + public void TestExplicitCastLSLIntegerToLSLFloat() + { + LSL_Types.LSLFloat testFloat; + + foreach (int number in m_intList) + { + testFloat = (LSL_Types.LSLFloat) new LSL_Types.LSLInteger(number); + Assert.That(testFloat.value, new DoubleToleranceConstraint(number, _lowPrecisionTolerance)); + } + } + + /// /// Tests string is correctly cast implicitly to LSLFloat. /// [Test] @@ -319,7 +349,7 @@ namespace OpenSim.Region.ScriptEngine.Common.Tests } /// - /// Tests string is correctly cast implicitly to LSLFloat. + /// Tests LSLString is correctly cast implicitly to LSLFloat. /// [Test] public void TestExplicitCastLSLStringToLSLFloat() -- cgit v1.1