Skip to content

Expectation::toBeSorted ​

Member of Expectation

idl
Expectation.toBeSorted, $
  /_expect_failure, $
  /descending

Verifies that the expectation value (an array or list of real numbers or strings) is sorted. Equal neighbors are allowed, and arrays with fewer than two elements are always sorted. Multi dimensional arrays are checked in memory order.

Examples ​

idl
(it.expects([1, 2, 2, 3])).toBeSorted
(it.expects([3, 2, 1])).toBeSorted, /descending
(it.expects(['b', 'a']))._not_.toBeSorted

Keywords ​

_expect_failure {#kw-_expect_failure} ​

optionalinputtype=Boolean

If the test fails for some reason, set this to force passing because we expected failure. This keyword is for internal use only.

descending ​

optionalinputtype=Boolean

Set this keyword to check for descending order instead.

Licensed under MIT.