diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-08-24 01:27:48 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-08-24 01:27:48 +0200 |
commit | 280131a6f8e92e137743b4f9ae0d877d28e82961 (patch) | |
tree | 696461fcbf087ccb0a9fc0f93128241512ecc135 | |
parent | a8afcaadb2b09c7f515fd53be4dc7a51b381ae4b (diff) | |
download | sink-280131a6f8e92e137743b4f9ae0d877d28e82961.tar.gz sink-280131a6f8e92e137743b4f9ae0d877d28e82961.zip |
HAWD: Ensure the formatter sorts the rows.
-rw-r--r-- | tests/hawd/formatter.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
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 | |||
42 | void Formatter::print(Dataset &dataset, const QStringList &cols) | 42 | void Formatter::print(Dataset &dataset, const QStringList &cols) |
43 | { | 43 | { |
44 | std::cout << dataset.tableHeaders(cols).toStdString() << std::endl; | 44 | std::cout << dataset.tableHeaders(cols).toStdString() << std::endl; |
45 | //Just reading doesn't sort the rows, let's use a map | ||
46 | QMap<qint64, QString> rows; | ||
45 | dataset.eachRow( | 47 | dataset.eachRow( |
46 | [cols](const Dataset::Row &row) { | 48 | [cols, &rows](const Dataset::Row &row) { |
47 | std::cout << row.toString(cols).toStdString() << std::endl; | 49 | rows.insert(row.key(), row.toString()); |
48 | }); | 50 | }); |
51 | for (const auto &s : rows.values().mid(rows.size() - 10)) { | ||
52 | std::cout << s.toStdString() << std::endl; | ||
53 | } | ||
49 | } | 54 | } |
50 | 55 | ||
51 | } | 56 | } |