Class NumberTheoryAssertions
- Namespace
- MathAssertions.TUnit
- Assembly
- MathAssertions.TUnit.dll
Fluent NumberTheory assertions over long
integers. The non-predicate helpers (GreatestCommonDivisor,
LeastCommonMultiple) are not exposed as fluent assertions in 0.1.0; consumers
can call them statically and apply ScalarAssertions on the result.
public static class NumberTheoryAssertions
- Inheritance
-
NumberTheoryAssertions
- Inherited Members
Methods
IsCongruentTo(long, long, long)
Asserts value is congruent to other modulo
modulus.
[GenerateAssertion(ExpectationMessage = "to be congruent to {other} modulo {modulus}", InlineMethodBody = true)]
public static bool IsCongruentTo(this long value, long other, long modulus)
Parameters
Returns
IsCoprimeWith(long, long)
Asserts value and other share no common divisor other than 1.
[GenerateAssertion(ExpectationMessage = "to be coprime with {other}", InlineMethodBody = true)]
public static bool IsCoprimeWith(this long value, long other)
Parameters
Returns
IsDivisibleBy(long, long)
Asserts value is exactly divisible by divisor.
[GenerateAssertion(ExpectationMessage = "to be divisible by {divisor}", InlineMethodBody = true)]
public static bool IsDivisibleBy(this long value, long divisor)
Parameters
Returns
IsPerfectSquare(long)
Asserts value is a non-negative perfect square.
[GenerateAssertion(ExpectationMessage = "to be a perfect square", InlineMethodBody = true)]
public static bool IsPerfectSquare(this long value)
Parameters
valuelong
Returns
IsPowerOf(long, long)
Asserts value is a non-negative integer power of
baseValue.
[GenerateAssertion(ExpectationMessage = "to be a power of {baseValue}", InlineMethodBody = true)]
public static bool IsPowerOf(this long value, long baseValue)
Parameters
Returns
IsPrime(long)
Asserts value is prime.
[GenerateAssertion(ExpectationMessage = "to be prime", InlineMethodBody = true)]
public static bool IsPrime(this long value)
Parameters
valuelong