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

Method bufferReader

tests/import_export/ASCII/AsciiFilterTest.cpp:3754–3794  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3752}
3753
3754void AsciiFilterTest::bufferReader() {
3755 {
3756 const auto b = QByteArray("Hallo123");
3757 BufferReader reader(b);
3758
3759 QByteArray out(10, 0);
3760 QCOMPARE(reader.readData(out.data(), 10), 8);
3761 QCOMPARE(out[0], QLatin1Char('H'));
3762 QCOMPARE(out[1], QLatin1Char('a'));
3763 QCOMPARE(out[2], QLatin1Char('l'));
3764 QCOMPARE(out[3], QLatin1Char('l'));
3765 QCOMPARE(out[4], QLatin1Char('o'));
3766 QCOMPARE(out[5], QLatin1Char('1'));
3767 QCOMPARE(out[6], QLatin1Char('2'));
3768 QCOMPARE(out[7], QLatin1Char('3'));
3769 }
3770
3771 {
3772 const auto b = QByteArray("Hallo1234");
3773 BufferReader reader(b);
3774
3775 QByteArray out(10, 0);
3776 QCOMPARE(reader.readData(out.data(), 2), 2);
3777 QCOMPARE(out[0], QLatin1Char('H'));
3778 QCOMPARE(out[1], QLatin1Char('a'));
3779
3780 QCOMPARE(reader.readData(out.data(), 2), 2);
3781 QCOMPARE(out[0], QLatin1Char('l'));
3782 QCOMPARE(out[1], QLatin1Char('l'));
3783
3784 QCOMPARE(reader.readData(out.data(), 2), 2);
3785 QCOMPARE(out[0], QLatin1Char('o'));
3786 QCOMPARE(out[1], QLatin1Char('1'));
3787
3788 QCOMPARE(reader.readData(out.data(), 5), 3);
3789 QCOMPARE(out[0], QLatin1Char('2'));
3790 QCOMPARE(out[1], QLatin1Char('3'));
3791 QCOMPARE(out[2], QLatin1Char('4'));
3792 QCOMPARE(reader.canReadLine(), false);
3793 }
3794}
3795
3796QTEST_MAIN(AsciiFilterTest)

Callers

nothing calls this directly

Calls 2

readDataMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected