TestableMList

object TestableMList extends Testable[MList]
class Object
trait Matchable
class Any

Value members

Concrete methods

override def copy(x: MList): MList
Definition Classes
override def equiv(x: MList, y: MList): Boolean
Definition Classes
override def lt(x: MList, y: MList): Boolean
Definition Classes
def parse: Src => MList

Inherited methods

def checkInvariant(x: MList): Unit

Throws an exception if an invariant fails. Otherwise, returns Unit.

Throws an exception if an invariant fails. Otherwise, returns Unit.

checkInvariant defaults to {}. Override this default for types that have meaningful internal invariants that you want to check automatically. Indicate that an invariant has been violated by throwing an exception, preferably with a meaningful error message. Note that checkInvariant will be called on each answer before comparing to the expected answer. That comparison would presumably also fail, so the advantage of checkInvariant is that it can display a different error message for failed invariants than ordinary errors, which matters because failed invariants often provide better clues for debugging than ordinary errors.

For example, checkInvariant might check if the keys in a binary search tree are ordered in the way they should be, and throw an exception if they aren't (ideally including a useful description in the message of the exception).

Inherited from:
Testable
final def format(x: MList): String

Returns a possibly-formatted string representing the given top-level value for display to the user.

Returns a possibly-formatted string representing the given top-level value for display to the user.

A top-level value is one that is a direct argument to or the direct result from a function being tested. All nested values should be displayed using show.

For example, if a function returns a BinaryTree, that result will be displayed in a graphical format, but if a function returns a list of BinaryTrees, that list (including the trees) will be displayed in a single-line format.

Equivalent to _format except includes a check for null.

To change the behavior of format, override _format instead.

Inherited from:
Testable
def label(name: String, x: MList): String
Inherited from:
Testable
def multiequiv[T](iter1: Iterator[T], iter2: Iterator[T], T: Testable[T]): Boolean

Check if two collections are equivalent.

Check if two collections are equivalent.

The collections are given as iterators. To be equivalent, the two iterators must be the same length, and the value at each position of iter1 must be equivalent to the value at the same position in iter2.

When multiequiv is called, the collections must be converted to iterators, and might need to be normalized, usually by sorting, so that corresponding elements end up in corresponding order. (Typcially such normalization would be needed for unordered collections but not for ordered collections.)

Inherited from:
Testable
def multilt[T](iter1: Iterator[T], iter2: Iterator[T], T: Testable[T]): Boolean

Check if one collection is considered "less than" another collection.

Check if one collection is considered "less than" another collection.

Typically used when normalizing a collection of collections.

The collections are given as iterators, which are compared lexicographically.

When multilt is called, the collections must be converted to iterators, and may need to be normalized, usually by sorting, so that corresponding elements end up in corresponding order. (Typically such normalization would be needed for unordered collections but not for ordered collections.)

Inherited from:
Testable

Like parse but also checks that the parsed value satisfies any invariant expected of a value of this type. Throws an exception in an invariant is not met.

Like parse but also checks that the parsed value satisfies any invariant expected of a value of this type. Throws an exception in an invariant is not met.

Inherited from:
Testable
final def show(x: MList): String

Returns a string representing the given value for display to the user.

Returns a string representing the given value for display to the user.

The returned string should normally not contain any line breaks, except possibly when a line break occurs in the contents of a quoted String or Char.

Equivalent to _show except includes a check for null.

To change the behavior of show, override _show instead.

Inherited from:
Testable

Concrete fields

val TI: TestableInt.type
val name: String