testutils: Print indices of iteratables (on assert equal fail)
This commit is contained in:
parent
a0c6868e88
commit
e393af5dbb
|
@ -5,6 +5,7 @@
|
||||||
#include "../conversion/types.h"
|
#include "../conversion/types.h"
|
||||||
#include "../misc/traits.h"
|
#include "../misc/traits.h"
|
||||||
|
|
||||||
|
#include <iomanip>
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -191,8 +192,12 @@ template <typename T> AsHexNumber<T> asHexNumber(const T &value)
|
||||||
template <typename Iteratable, Traits::EnableIf<Traits::IsIteratable<Iteratable>, Traits::Not<Traits::IsString<Iteratable>>>...>
|
template <typename Iteratable, Traits::EnableIf<Traits::IsIteratable<Iteratable>, Traits::Not<Traits::IsString<Iteratable>>>...>
|
||||||
inline std::ostream &operator<<(std::ostream &out, const Iteratable &iteratable)
|
inline std::ostream &operator<<(std::ostream &out, const Iteratable &iteratable)
|
||||||
{
|
{
|
||||||
for (const auto &item : iteratable)
|
out << '\n';
|
||||||
out << item << '\n';
|
std::size_t index = 0;
|
||||||
|
for (const auto &item : iteratable) {
|
||||||
|
out << std::setw(2) << index << ':' << ' ' << item << '\n';
|
||||||
|
++index;
|
||||||
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue