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

Method testSortSingleNumeric1

tests/spreadsheet/SpreadsheetTest.cpp:506–523  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

504 * check sorting single column of double values with NaN ascending
505 */
506void SpreadsheetTest::testSortSingleNumeric1() {
507 const QVector<double> xData{0.5, -0.2, GSL_NAN, 2.0, -1.0};
508
509 Spreadsheet sheet(QStringLiteral("test"), false);
510 sheet.setColumnCount(1);
511 sheet.setRowCount(7);
512 auto* col = sheet.column(0);
513 col->replaceValues(0, xData);
514
515 // sort
516 sheet.sortColumns(nullptr, {col}, true);
517
518 // values
519 QCOMPARE(col->valueAt(0), -1.0);
520 QCOMPARE(col->valueAt(1), -0.2);
521 QCOMPARE(col->valueAt(2), 0.5);
522 QCOMPARE(col->valueAt(3), 2.0);
523}
524
525/*
526 * check sorting single column of double values with NaN descending

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