Comparison Operations
Compare numeric values with these assertions.
Operands of different numeric types are promoted to a common type before comparing, following D’s usual arithmetic conversions, so mixing types works as expected:
double value = 3.22681e+10;expect(value).to.be.greaterThan(0); // double vs intexpect(-1).to.be.lessThan(1u); // signed vs unsigned, compared by valuegreaterThan / above / greater
Asserts that a value is greater than the expected value.
expect(42).to.be.greaterThan(10);expect(42).to.be.above(10); // aliasexpect(42).to.be.greater(10); // aliasgreaterOrEqualTo / greaterOrEqual
Asserts that a value is greater than or equal to the expected value.
expect(42).to.be.greaterOrEqualTo(42);expect(42).to.be.greaterOrEqual(10); // aliaslessThan / below / less
Asserts that a value is less than the expected value.
expect(10).to.be.lessThan(42);expect(10).to.be.below(42); // aliasexpect(10).to.be.less(42); // aliaslessOrEqualTo / lessOrEqual
Asserts that a value is less than or equal to the expected value.
expect(42).to.be.lessOrEqualTo(42);expect(10).to.be.lessOrEqual(42); // aliasbetween
Asserts that a value is between two bounds (exclusive).
expect(42).to.be.between(10, 100);within
Asserts that a value is within a range (inclusive).
expect(42).to.be.within(40, 45);