From 280131a6f8e92e137743b4f9ae0d877d28e82961 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 24 Aug 2015 01:27:48 +0200 Subject: HAWD: Ensure the formatter sorts the rows. --- tests/hawd/formatter.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'tests/hawd/formatter.cpp') diff --git a/tests/hawd/formatter.cpp b/tests/hawd/formatter.cpp index 6d1f6de..4221b03 100644 --- a/tests/hawd/formatter.cpp +++ b/tests/hawd/formatter.cpp @@ -42,10 +42,15 @@ void Formatter::print(const QString &datasetName, const QStringList &cols, State void Formatter::print(Dataset &dataset, const QStringList &cols) { std::cout << dataset.tableHeaders(cols).toStdString() << std::endl; + //Just reading doesn't sort the rows, let's use a map + QMap rows; dataset.eachRow( - [cols](const Dataset::Row &row) { - std::cout << row.toString(cols).toStdString() << std::endl; + [cols, &rows](const Dataset::Row &row) { + rows.insert(row.key(), row.toString()); }); + for (const auto &s : rows.values().mid(rows.size() - 10)) { + std::cout << s.toStdString() << std::endl; + } } } -- cgit v1.2.3