template<class T>
Corrade::TestSuite::Compare::SortedContainer class

Pseudo-type for comparing sorted container contents.

Compared to Container the containers are sorted before performing the comparison, making it possible to compare against expected contents even when any side may be in a random order (such as when listing filesystem directory contents). Can be also used to compare contents of containers that don't provide random access (such as std::list or std::map) or have an unspecified order (such as std::unordered_map). Example usage:

CORRADE_COMPARE_AS(a, b, TestSuite::Compare::SortedContainer);

The operation is performed by first copying contents of both containers to new Containers::Array instances, performing std::sort() on them and then passing them to Container for doing actual comparison. The stored types are expected to implement operator<() and be copyable. The container itself doesn't need to be copyable.

See Comparing with pseudo-types for more information.

Base classes

class Container<T>
Pseudo-type for comparing container contents.