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

Method testSortSingleBigInt1

tests/spreadsheet/SpreadsheetTest.cpp:606–629  ·  view source on GitHub ↗

* check sorting single column of big int values with empty entries ascending */

Source from the content-addressed store, hash-verified

604 * check sorting single column of big int values with empty entries ascending
605 */
606void SpreadsheetTest::testSortSingleBigInt1() {
607 const QVector<qint64> xData1{40000000000, 50000000000, 20000000000};
608 const QVector<qint64> xData2{30000000000, 60000000000, -10000000000};
609
610 Spreadsheet sheet(QStringLiteral("test"), false);
611 sheet.setColumnCount(1);
612 sheet.setRowCount(7);
613 auto* col = sheet.column(0);
614 col->setColumnMode(AbstractColumn::ColumnMode::BigInt);
615 col->replaceBigInt(0, xData1);
616 col->replaceBigInt(4, xData2);
617
618 // sort
619 sheet.sortColumns(nullptr, {col}, true);
620
621 // values
622 QCOMPARE(col->bigIntAt(0), -10000000000ll);
623 QCOMPARE(col->bigIntAt(1), 0);
624 QCOMPARE(col->bigIntAt(2), 20000000000ll);
625 QCOMPARE(col->bigIntAt(3), 30000000000ll);
626 QCOMPARE(col->bigIntAt(4), 40000000000ll);
627 QCOMPARE(col->bigIntAt(5), 50000000000ll);
628 QCOMPARE(col->bigIntAt(6), 60000000000ll);
629}
630
631/*
632 * check sorting single column of big int values with empty entries descending

Callers

nothing calls this directly

Calls 7

setColumnCountMethod · 0.45
setRowCountMethod · 0.45
columnMethod · 0.45
setColumnModeMethod · 0.45
replaceBigIntMethod · 0.45
sortColumnsMethod · 0.45
bigIntAtMethod · 0.45

Tested by

no test coverage detected