* check sorting double values with NaN descending as leading column */
| 814 | * check sorting double values with NaN descending as leading column |
| 815 | */ |
| 816 | void SpreadsheetTest::testSortNumeric2() { |
| 817 | const QVector<double> xData{0.5, -0.2, GSL_NAN, 2.0, -1.0}; |
| 818 | const QVector<int> yData{1, 2, 3, 4, 5, 6, 7}; |
| 819 | |
| 820 | Spreadsheet sheet(QStringLiteral("test"), false); |
| 821 | sheet.setColumnCount(2); |
| 822 | sheet.setRowCount(10); |
| 823 | auto* col0{sheet.column(0)}; |
| 824 | auto* col1{sheet.column(1)}; |
| 825 | col0->replaceValues(0, xData); |
| 826 | col1->setColumnMode(AbstractColumn::ColumnMode::Integer); |
| 827 | col1->replaceInteger(0, yData); |
| 828 | |
| 829 | // sort |
| 830 | sheet.sortColumns(col0, {col0, col1}, false); |
| 831 | |
| 832 | // values |
| 833 | QCOMPARE(col0->valueAt(0), 2.0); |
| 834 | QCOMPARE(col0->valueAt(1), 0.5); |
| 835 | QCOMPARE(col0->valueAt(2), -0.2); |
| 836 | QCOMPARE(col0->valueAt(3), -1.0); |
| 837 | QCOMPARE(col1->integerAt(0), 4); |
| 838 | QCOMPARE(col1->integerAt(1), 1); |
| 839 | QCOMPARE(col1->integerAt(2), 2); |
| 840 | QCOMPARE(col1->integerAt(3), 5); |
| 841 | QCOMPARE(col1->integerAt(4), 3); |
| 842 | QCOMPARE(col1->integerAt(5), 6); |
| 843 | QCOMPARE(col1->integerAt(6), 7); |
| 844 | } |
| 845 | |
| 846 | /* |
| 847 | * check sorting integer values with empty entries ascending as leading column |
nothing calls this directly
no test coverage detected