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

Method testSortSingleBigInt2

tests/spreadsheet/SpreadsheetTest.cpp:634–657  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

632 * check sorting single column of big int values with empty entries descending
633 */
634void SpreadsheetTest::testSortSingleBigInt2() {
635 const QVector<qint64> xData1{40000000000, 50000000000, 20000000000};
636 const QVector<qint64> xData2{30000000000, 60000000000, -10000000000};
637
638 Spreadsheet sheet(QStringLiteral("test"), false);
639 sheet.setColumnCount(1);
640 sheet.setRowCount(7);
641 auto* col = sheet.column(0);
642 col->setColumnMode(AbstractColumn::ColumnMode::BigInt);
643 col->replaceBigInt(0, xData1);
644 col->replaceBigInt(4, xData2);
645
646 // sort
647 sheet.sortColumns(nullptr, {col}, false);
648
649 // values
650 QCOMPARE(col->bigIntAt(6), -10000000000ll);
651 QCOMPARE(col->bigIntAt(5), 0);
652 QCOMPARE(col->bigIntAt(4), 20000000000ll);
653 QCOMPARE(col->bigIntAt(3), 30000000000ll);
654 QCOMPARE(col->bigIntAt(2), 40000000000ll);
655 QCOMPARE(col->bigIntAt(1), 50000000000ll);
656 QCOMPARE(col->bigIntAt(0), 60000000000ll);
657}
658
659/*
660 * check sorting single column of text with empty entries ascending

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