Class SequencesAssertions
- Namespace
- MathAssertions.TUnit
- Assembly
- MathAssertions.TUnit.dll
Fluent Sequences assertions over double
arrays plus the generic length predicates over any T[]. Arrays are used at
the adapter surface for the same ref-struct reason documented on
ArrayAssertions; null arrays are rejected at entry.
public static class SequencesAssertions
- Inheritance
-
SequencesAssertions
- Inherited Members
Methods
ConvergesTo(double[], double, double)
Asserts the last value of the sequence is within tolerance of the limit.
[GenerateAssertion(ExpectationMessage = "to converge to {limit} within tolerance {tolerance}", InlineMethodBody = false)]
public static bool ConvergesTo(this double[] value, double limit, double tolerance)
Parameters
Returns
HasLength<T>(T[], int)
Asserts the array has exactly expected elements.
[GenerateAssertion(ExpectationMessage = "to have length {expected}", InlineMethodBody = false)]
public static bool HasLength<T>(this T[] value, int expected)
Parameters
valueT[]expectedint
Returns
Type Parameters
T
HasMinLength<T>(T[], int)
Asserts the array has at least expected elements.
[GenerateAssertion(ExpectationMessage = "to have at least {expected} elements", InlineMethodBody = false)]
public static bool HasMinLength<T>(this T[] value, int expected)
Parameters
valueT[]expectedint
Returns
Type Parameters
T
IsArithmeticProgression(double[], double)
Asserts adjacent differences are equal within tolerance (arithmetic progression).
[GenerateAssertion(ExpectationMessage = "to be an arithmetic progression within tolerance {tolerance}", InlineMethodBody = false)]
public static bool IsArithmeticProgression(this double[] value, double tolerance)
Parameters
Returns
IsBounded(double[], double, double)
Asserts every value is in the closed interval [min, max].
[GenerateAssertion(ExpectationMessage = "to be bounded by [{min}, {max}]", InlineMethodBody = false)]
public static bool IsBounded(this double[] value, double min, double max)
Parameters
Returns
IsCauchyConvergent(double[], double)
Single-step Cauchy criterion: last two values within tolerance of each other.
[GenerateAssertion(ExpectationMessage = "to be Cauchy convergent within tolerance {tolerance}", InlineMethodBody = false)]
public static bool IsCauchyConvergent(this double[] value, double tolerance)
Parameters
Returns
IsGeometricProgression(double[], double)
Asserts adjacent ratios are equal within tolerance (geometric progression).
[GenerateAssertion(ExpectationMessage = "to be a geometric progression within tolerance {tolerance}", InlineMethodBody = false)]
public static bool IsGeometricProgression(this double[] value, double tolerance)
Parameters
Returns
IsMonotonicallyDecreasing(double[])
Asserts the sequence is non-increasing.
[GenerateAssertion(ExpectationMessage = "to be monotonically decreasing", InlineMethodBody = false)]
public static bool IsMonotonicallyDecreasing(this double[] value)
Parameters
valuedouble[]
Returns
IsMonotonicallyIncreasing(double[])
Asserts the sequence is non-decreasing.
[GenerateAssertion(ExpectationMessage = "to be monotonically increasing", InlineMethodBody = false)]
public static bool IsMonotonicallyIncreasing(this double[] value)
Parameters
valuedouble[]
Returns
IsSorted(double[])
Asserts the sequence is sorted (alias for IsMonotonicallyIncreasing(double[])).
[GenerateAssertion(ExpectationMessage = "to be sorted ascending", InlineMethodBody = false)]
public static bool IsSorted(this double[] value)
Parameters
valuedouble[]
Returns
IsStrictlyMonotonicallyDecreasing(double[])
Asserts the sequence is strictly decreasing.
[GenerateAssertion(ExpectationMessage = "to be strictly monotonically decreasing", InlineMethodBody = false)]
public static bool IsStrictlyMonotonicallyDecreasing(this double[] value)
Parameters
valuedouble[]
Returns
IsStrictlyMonotonicallyIncreasing(double[])
Asserts the sequence is strictly increasing (adjacent equal values fail).
[GenerateAssertion(ExpectationMessage = "to be strictly monotonically increasing", InlineMethodBody = false)]
public static bool IsStrictlyMonotonicallyIncreasing(this double[] value)
Parameters
valuedouble[]