Table of Contents

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

value long
other long
modulus long

Returns

bool

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

value long
other long

Returns

bool

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

value long
divisor long

Returns

bool

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

value long

Returns

bool

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

value long
baseValue long

Returns

bool

IsPrime(long)

Asserts value is prime.

[GenerateAssertion(ExpectationMessage = "to be prime", InlineMethodBody = true)]
public static bool IsPrime(this long value)

Parameters

value long

Returns

bool