From 24ac86931a79b3968c5c6c00f93bb92bf967ea75 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Fri, 8 Feb 2008 18:18:56 +0000 Subject: update eol-style --- .../Tests/Common/ANumericalToleranceConstraint.cs | 60 +++++------ OpenSim/Tests/Common/DoubleToleranceConstraint.cs | 104 +++++++++--------- OpenSim/Tests/Common/TestHelper.cs | 50 ++++----- OpenSim/Tests/Common/VectorToleranceConstraint.cs | 116 ++++++++++----------- 4 files changed, 165 insertions(+), 165 deletions(-) (limited to 'OpenSim/Tests/Common') diff --git a/OpenSim/Tests/Common/ANumericalToleranceConstraint.cs b/OpenSim/Tests/Common/ANumericalToleranceConstraint.cs index 289e4bb..2a6993d 100644 --- a/OpenSim/Tests/Common/ANumericalToleranceConstraint.cs +++ b/OpenSim/Tests/Common/ANumericalToleranceConstraint.cs @@ -1,30 +1,30 @@ -using System; -using NUnit.Framework.Constraints; - -namespace OpenSim.Tests.Common -{ - public abstract class ANumericalToleranceConstraint : Constraint - { - protected double _tolerance; - - public ANumericalToleranceConstraint(double tolerance) - { - if (tolerance < 0) - { - throw new ArgumentException("Tolerance cannot be negative."); - } - _tolerance = tolerance; - } - - - protected bool IsWithinDoubleConstraint(double doubleValue, double baseValue) - { - if (doubleValue >= baseValue - _tolerance && doubleValue <= baseValue + _tolerance) - { - return true; - } - - return false; - } - } -} +using System; +using NUnit.Framework.Constraints; + +namespace OpenSim.Tests.Common +{ + public abstract class ANumericalToleranceConstraint : Constraint + { + protected double _tolerance; + + public ANumericalToleranceConstraint(double tolerance) + { + if (tolerance < 0) + { + throw new ArgumentException("Tolerance cannot be negative."); + } + _tolerance = tolerance; + } + + + protected bool IsWithinDoubleConstraint(double doubleValue, double baseValue) + { + if (doubleValue >= baseValue - _tolerance && doubleValue <= baseValue + _tolerance) + { + return true; + } + + return false; + } + } +} diff --git a/OpenSim/Tests/Common/DoubleToleranceConstraint.cs b/OpenSim/Tests/Common/DoubleToleranceConstraint.cs index f3da236..eb71aeb 100644 --- a/OpenSim/Tests/Common/DoubleToleranceConstraint.cs +++ b/OpenSim/Tests/Common/DoubleToleranceConstraint.cs @@ -1,52 +1,52 @@ -using System; -using NUnit.Framework; -using NUnit.Framework.Constraints; -using OpenSim.Tests.Common; - -namespace OpenSim.Tests.Common -{ - public class DoubleToleranceConstraint : ANumericalToleranceConstraint - { - - private double _baseValue; - private double _valueToBeTested; - - public DoubleToleranceConstraint(double baseValue, double tolerance) : base(tolerance) - { - _baseValue = baseValue; - } - - /// - ///Test whether the constraint is satisfied by a given value - /// - ///The value to be tested - /// - ///True for success, false for failure - /// - public override bool Matches(object valueToBeTested) - { - if (valueToBeTested == null) - { - throw new ArgumentException("Constraint cannot be used upon null values."); - } - if( valueToBeTested.GetType() != typeof(double)) - { - throw new ArgumentException("Constraint cannot be used upon non double-values."); - } - - _valueToBeTested = (double)valueToBeTested; - - return IsWithinDoubleConstraint(_valueToBeTested, _baseValue ); - } - - public override void WriteDescriptionTo(MessageWriter writer) - { - writer.WriteExpectedValue(string.Format("A value {0} within tolerance of plus or minus {1}",_baseValue,_tolerance)); - } - - public override void WriteActualValueTo(MessageWriter writer) - { - writer.WriteActualValue(_valueToBeTested); - } - } -} +using System; +using NUnit.Framework; +using NUnit.Framework.Constraints; +using OpenSim.Tests.Common; + +namespace OpenSim.Tests.Common +{ + public class DoubleToleranceConstraint : ANumericalToleranceConstraint + { + + private double _baseValue; + private double _valueToBeTested; + + public DoubleToleranceConstraint(double baseValue, double tolerance) : base(tolerance) + { + _baseValue = baseValue; + } + + /// + ///Test whether the constraint is satisfied by a given value + /// + ///The value to be tested + /// + ///True for success, false for failure + /// + public override bool Matches(object valueToBeTested) + { + if (valueToBeTested == null) + { + throw new ArgumentException("Constraint cannot be used upon null values."); + } + if( valueToBeTested.GetType() != typeof(double)) + { + throw new ArgumentException("Constraint cannot be used upon non double-values."); + } + + _valueToBeTested = (double)valueToBeTested; + + return IsWithinDoubleConstraint(_valueToBeTested, _baseValue ); + } + + public override void WriteDescriptionTo(MessageWriter writer) + { + writer.WriteExpectedValue(string.Format("A value {0} within tolerance of plus or minus {1}",_baseValue,_tolerance)); + } + + public override void WriteActualValueTo(MessageWriter writer) + { + writer.WriteActualValue(_valueToBeTested); + } + } +} diff --git a/OpenSim/Tests/Common/TestHelper.cs b/OpenSim/Tests/Common/TestHelper.cs index f59c157..9dc6aa7 100644 --- a/OpenSim/Tests/Common/TestHelper.cs +++ b/OpenSim/Tests/Common/TestHelper.cs @@ -1,25 +1,25 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Tests.Common -{ - public delegate void TestDelegate(); - - public class TestHelper - { - public static bool AssertThisDelegateCausesArgumentException(TestDelegate d) - { - try - { - d(); - } - catch(ArgumentException e) - { - return true; - } - - return false; - } - } -} +using System; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Tests.Common +{ + public delegate void TestDelegate(); + + public class TestHelper + { + public static bool AssertThisDelegateCausesArgumentException(TestDelegate d) + { + try + { + d(); + } + catch(ArgumentException e) + { + return true; + } + + return false; + } + } +} diff --git a/OpenSim/Tests/Common/VectorToleranceConstraint.cs b/OpenSim/Tests/Common/VectorToleranceConstraint.cs index 1faf7dd..3f32830 100644 --- a/OpenSim/Tests/Common/VectorToleranceConstraint.cs +++ b/OpenSim/Tests/Common/VectorToleranceConstraint.cs @@ -1,58 +1,58 @@ -using System; -using libsecondlife; -using NUnit.Framework; - -namespace OpenSim.Tests.Common -{ - public class VectorToleranceConstraint : ANumericalToleranceConstraint - { - private LLVector3 _baseValue; - private LLVector3 _valueToBeTested; - - public VectorToleranceConstraint(LLVector3 baseValue, double tolerance) : base(tolerance) - { - _baseValue = baseValue; - } - - /// - ///Test whether the constraint is satisfied by a given value - /// - ///The value to be tested - /// - ///True for success, false for failure - /// - public override bool Matches(object valueToBeTested) - { - if (valueToBeTested == null) - { - throw new ArgumentException("Constraint cannot be used upon null values."); - } - if (valueToBeTested.GetType() != typeof (LLVector3)) - { - throw new ArgumentException("Constraint cannot be used upon non vector values."); - } - - _valueToBeTested = (LLVector3) valueToBeTested; - - if ( IsWithinDoubleConstraint(_valueToBeTested.X,_baseValue.X) && - IsWithinDoubleConstraint(_valueToBeTested.Y,_baseValue.Y) && - IsWithinDoubleConstraint(_valueToBeTested.Z,_baseValue.Z) ) - { - return true; - } - - return false; - } - - public override void WriteDescriptionTo(MessageWriter writer) - { - writer.WriteExpectedValue( - string.Format("A value {0} within tolerance of plus or minus {1}", _baseValue, _tolerance)); - } - - public override void WriteActualValueTo(MessageWriter writer) - { - writer.WriteActualValue(_valueToBeTested); - } - } -} +using System; +using libsecondlife; +using NUnit.Framework; + +namespace OpenSim.Tests.Common +{ + public class VectorToleranceConstraint : ANumericalToleranceConstraint + { + private LLVector3 _baseValue; + private LLVector3 _valueToBeTested; + + public VectorToleranceConstraint(LLVector3 baseValue, double tolerance) : base(tolerance) + { + _baseValue = baseValue; + } + + /// + ///Test whether the constraint is satisfied by a given value + /// + ///The value to be tested + /// + ///True for success, false for failure + /// + public override bool Matches(object valueToBeTested) + { + if (valueToBeTested == null) + { + throw new ArgumentException("Constraint cannot be used upon null values."); + } + if (valueToBeTested.GetType() != typeof (LLVector3)) + { + throw new ArgumentException("Constraint cannot be used upon non vector values."); + } + + _valueToBeTested = (LLVector3) valueToBeTested; + + if ( IsWithinDoubleConstraint(_valueToBeTested.X,_baseValue.X) && + IsWithinDoubleConstraint(_valueToBeTested.Y,_baseValue.Y) && + IsWithinDoubleConstraint(_valueToBeTested.Z,_baseValue.Z) ) + { + return true; + } + + return false; + } + + public override void WriteDescriptionTo(MessageWriter writer) + { + writer.WriteExpectedValue( + string.Format("A value {0} within tolerance of plus or minus {1}", _baseValue, _tolerance)); + } + + public override void WriteActualValueTo(MessageWriter writer) + { + writer.WriteActualValue(_valueToBeTested); + } + } +} -- cgit v1.1