aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/DoubleToleranceConstraint.cs
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-02-08 18:18:56 +0000
committerJustin Clarke Casey2008-02-08 18:18:56 +0000
commit24ac86931a79b3968c5c6c00f93bb92bf967ea75 (patch)
treefbc90f13b13a3e7024ab92f3238746da85f3ae62 /OpenSim/Tests/Common/DoubleToleranceConstraint.cs
parent* Made some terrain functions faster computationally. (diff)
downloadopensim-SC-24ac86931a79b3968c5c6c00f93bb92bf967ea75.zip
opensim-SC-24ac86931a79b3968c5c6c00f93bb92bf967ea75.tar.gz
opensim-SC-24ac86931a79b3968c5c6c00f93bb92bf967ea75.tar.bz2
opensim-SC-24ac86931a79b3968c5c6c00f93bb92bf967ea75.tar.xz
update eol-style
Diffstat (limited to 'OpenSim/Tests/Common/DoubleToleranceConstraint.cs')
-rw-r--r--OpenSim/Tests/Common/DoubleToleranceConstraint.cs104
1 files changed, 52 insertions, 52 deletions
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 @@
1using System; 1using System;
2using NUnit.Framework; 2using NUnit.Framework;
3using NUnit.Framework.Constraints; 3using NUnit.Framework.Constraints;
4using OpenSim.Tests.Common; 4using OpenSim.Tests.Common;
5 5
6namespace OpenSim.Tests.Common 6namespace OpenSim.Tests.Common
7{ 7{
8 public class DoubleToleranceConstraint : ANumericalToleranceConstraint 8 public class DoubleToleranceConstraint : ANumericalToleranceConstraint
9 { 9 {
10 10
11 private double _baseValue; 11 private double _baseValue;
12 private double _valueToBeTested; 12 private double _valueToBeTested;
13 13
14 public DoubleToleranceConstraint(double baseValue, double tolerance) : base(tolerance) 14 public DoubleToleranceConstraint(double baseValue, double tolerance) : base(tolerance)
15 { 15 {
16 _baseValue = baseValue; 16 _baseValue = baseValue;
17 } 17 }
18 18
19 ///<summary> 19 ///<summary>
20 ///Test whether the constraint is satisfied by a given value 20 ///Test whether the constraint is satisfied by a given value
21 ///</summary> 21 ///</summary>
22 ///<param name="valueToBeTested">The value to be tested</param> 22 ///<param name="valueToBeTested">The value to be tested</param>
23 ///<returns> 23 ///<returns>
24 ///True for success, false for failure 24 ///True for success, false for failure
25 ///</returns> 25 ///</returns>
26 public override bool Matches(object valueToBeTested) 26 public override bool Matches(object valueToBeTested)
27 { 27 {
28 if (valueToBeTested == null) 28 if (valueToBeTested == null)
29 { 29 {
30 throw new ArgumentException("Constraint cannot be used upon null values."); 30 throw new ArgumentException("Constraint cannot be used upon null values.");
31 } 31 }
32 if( valueToBeTested.GetType() != typeof(double)) 32 if( valueToBeTested.GetType() != typeof(double))
33 { 33 {
34 throw new ArgumentException("Constraint cannot be used upon non double-values."); 34 throw new ArgumentException("Constraint cannot be used upon non double-values.");
35 } 35 }
36 36
37 _valueToBeTested = (double)valueToBeTested; 37 _valueToBeTested = (double)valueToBeTested;
38 38
39 return IsWithinDoubleConstraint(_valueToBeTested, _baseValue ); 39 return IsWithinDoubleConstraint(_valueToBeTested, _baseValue );
40 } 40 }
41 41
42 public override void WriteDescriptionTo(MessageWriter writer) 42 public override void WriteDescriptionTo(MessageWriter writer)
43 { 43 {
44 writer.WriteExpectedValue(string.Format("A value {0} within tolerance of plus or minus {1}",_baseValue,_tolerance)); 44 writer.WriteExpectedValue(string.Format("A value {0} within tolerance of plus or minus {1}",_baseValue,_tolerance));
45 } 45 }
46 46
47 public override void WriteActualValueTo(MessageWriter writer) 47 public override void WriteActualValueTo(MessageWriter writer)
48 { 48 {
49 writer.WriteActualValue(_valueToBeTested); 49 writer.WriteActualValue(_valueToBeTested);
50 } 50 }
51 } 51 }
52} 52}