IGLib  1.7.2
The IGLib base library EXTENDED - with other lilbraries and applications.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
NUnit.Framework.Constraints.Tolerance Class Reference

The Tolerance class generalizes the notion of a tolerance within which an equality test succeeds. Normally, it is used with numeric types, but it can be used with any type that supports taking a difference between two objects and comparing that difference to a value. More...

Public Member Functions

 Tolerance (object amount)
 Constructs a linear tolerance of a specified amount More...
 

Properties

static Tolerance Default [get]
 Returns a default Tolerance object, equivalent to specifying an exact match unless GlobalSettings.DefaultFloatingPointTolerance is set, in which case, the GlobalSettings.DefaultFloatingPointTolerance will be used. More...
 
static Tolerance Exact [get]
 Returns an empty Tolerance object, equivalent to specifying an exact match even if GlobalSettings.DefaultFloatingPointTolerance is set. More...
 
ToleranceMode Mode [get]
 Gets the ToleranceMode for the current Tolerance More...
 
object Value [get]
 Gets the value of the current Tolerance instance. More...
 
Tolerance Percent [get]
 Returns a new tolerance, using the current amount as a percentage. More...
 
Tolerance Ulps [get]
 Returns a new tolerance, using the current amount in Ulps More...
 
Tolerance Days [get]
 Returns a new tolerance with a TimeSpan as the amount, using the current amount as a number of days. More...
 
Tolerance Hours [get]
 Returns a new tolerance with a TimeSpan as the amount, using the current amount as a number of hours. More...
 
Tolerance Minutes [get]
 Returns a new tolerance with a TimeSpan as the amount, using the current amount as a number of minutes. More...
 
Tolerance Seconds [get]
 Returns a new tolerance with a TimeSpan as the amount, using the current amount as a number of seconds. More...
 
Tolerance Milliseconds [get]
 Returns a new tolerance with a TimeSpan as the amount, using the current amount as a number of milliseconds. More...
 
Tolerance Ticks [get]
 Returns a new tolerance with a TimeSpan as the amount, using the current amount as a number of clock ticks. More...
 
bool IsUnsetOrDefault [get]
 Returns true if the current tolerance has not been set or is using the . More...
 

Private Member Functions

 Tolerance (object amount, ToleranceMode mode)
 Constructs a tolerance given an amount and ToleranceMode More...
 
void CheckLinearAndNumeric ()
 Tests that the current Tolerance is linear with a numeric value, throwing an exception if it is not. More...
 

Private Attributes

readonly ToleranceMode mode
 
readonly object amount
 
const string ModeMustFollowTolerance = "Tolerance amount must be specified before setting mode"
 
const string MultipleToleranceModes = "Tried to use multiple tolerance modes at the same time"
 
const string NumericToleranceRequired = "A numeric tolerance is required"
 

Detailed Description

The Tolerance class generalizes the notion of a tolerance within which an equality test succeeds. Normally, it is used with numeric types, but it can be used with any type that supports taking a difference between two objects and comparing that difference to a value.

Constructor & Destructor Documentation

NUnit.Framework.Constraints.Tolerance.Tolerance ( object  amount)
inline

Constructs a linear tolerance of a specified amount

References NUnit.Framework.Constraints.Linear.

NUnit.Framework.Constraints.Tolerance.Tolerance ( object  amount,
ToleranceMode  mode 
)
inlineprivate

Constructs a tolerance given an amount and ToleranceMode

Member Function Documentation

void NUnit.Framework.Constraints.Tolerance.CheckLinearAndNumeric ( )
inlineprivate

Tests that the current Tolerance is linear with a numeric value, throwing an exception if it is not.

References NUnit.Framework.Constraints.Numerics.IsNumericType().

Member Data Documentation

readonly ToleranceMode NUnit.Framework.Constraints.Tolerance.mode
private
readonly object NUnit.Framework.Constraints.Tolerance.amount
private
const string NUnit.Framework.Constraints.Tolerance.ModeMustFollowTolerance = "Tolerance amount must be specified before setting mode"
private
const string NUnit.Framework.Constraints.Tolerance.MultipleToleranceModes = "Tried to use multiple tolerance modes at the same time"
private
const string NUnit.Framework.Constraints.Tolerance.NumericToleranceRequired = "A numeric tolerance is required"
private

Property Documentation

ToleranceMode NUnit.Framework.Constraints.Tolerance.Mode
get
object NUnit.Framework.Constraints.Tolerance.Value
get
Tolerance NUnit.Framework.Constraints.Tolerance.Percent
get

Returns a new tolerance, using the current amount as a percentage.

Referenced by NUnit.Framework.Constraints.NumericsTests.SetUp().

Tolerance NUnit.Framework.Constraints.Tolerance.Ulps
get

Returns a new tolerance, using the current amount in Ulps

Tolerance NUnit.Framework.Constraints.Tolerance.Days
get

Returns a new tolerance with a TimeSpan as the amount, using the current amount as a number of days.

Tolerance NUnit.Framework.Constraints.Tolerance.Hours
get

Returns a new tolerance with a TimeSpan as the amount, using the current amount as a number of hours.

Tolerance NUnit.Framework.Constraints.Tolerance.Minutes
get

Returns a new tolerance with a TimeSpan as the amount, using the current amount as a number of minutes.

Tolerance NUnit.Framework.Constraints.Tolerance.Seconds
get

Returns a new tolerance with a TimeSpan as the amount, using the current amount as a number of seconds.

Tolerance NUnit.Framework.Constraints.Tolerance.Milliseconds
get

Returns a new tolerance with a TimeSpan as the amount, using the current amount as a number of milliseconds.

Tolerance NUnit.Framework.Constraints.Tolerance.Ticks
get

Returns a new tolerance with a TimeSpan as the amount, using the current amount as a number of clock ticks.

bool NUnit.Framework.Constraints.Tolerance.IsUnsetOrDefault
get

Returns true if the current tolerance has not been set or is using the .

Referenced by NUnit.Framework.Constraints.EqualConstraint.Within(), and NUnit.Framework.Internal.TextMessageWriter.WriteExpectedLine().


The documentation for this class was generated from the following file: