MCPcopy Create free account
hub / github.com/KDE/labplot / testSortSingleNumeric2

Method testSortSingleNumeric2

tests/spreadsheet/SpreadsheetTest.cpp:528–545  ·  view source on GitHub ↗

* check sorting single column of double values with NaN descending */

Source from the content-addressed store, hash-verified

526 * check sorting single column of double values with NaN descending
527 */
528void SpreadsheetTest::testSortSingleNumeric2() {
529 const QVector<double> xData{0.5, -0.2, GSL_NAN, 2.0, -1.0};
530
531 Spreadsheet sheet(QStringLiteral("test"), false);
532 sheet.setColumnCount(1);
533 sheet.setRowCount(7);
534 auto* col = sheet.column(0);
535 col->replaceValues(0, xData);
536
537 // sort
538 sheet.sortColumns(nullptr, {col}, false);
539
540 // values
541 QCOMPARE(col->valueAt(0), 2.0);
542 QCOMPARE(col->valueAt(1), 0.5);
543 QCOMPARE(col->valueAt(2), -0.2);
544 QCOMPARE(col->valueAt(3), -1.0);
545}
546
547/*
548 * check sorting single column of integer values with empty entries ascending

Callers

nothing calls this directly

Calls 6

setColumnCountMethod · 0.45
setRowCountMethod · 0.45
columnMethod · 0.45
replaceValuesMethod · 0.45
sortColumnsMethod · 0.45
valueAtMethod · 0.45

Tested by

no test coverage detected