MCPcopy Create free account
hub / github.com/aethersdr/AetherSDR / section4

Function section4

tests/rigctld_test.cpp:598–737  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

596// ═════════════════════════════════════════════════════════════════════════════
597
598void section4(RigctlClient& c, Runner& r)
599{
600 r.section(QStringLiteral("Section 4 — VFO"));
601
602 static const QSet<QString> kValidVfos = {
603 QStringLiteral("VFOA"), QStringLiteral("VFOB"),
604 QStringLiteral("Main"), QStringLiteral("Sub"), QStringLiteral("currVFO"),
605 };
606
607 // 4.1 get_vfo
608 QStringList lines = c.send(QStringLiteral("\\get_vfo"));
609 const QString vfo = c.field(lines, QStringLiteral("VFO"));
610 r.check(QStringLiteral("4.1 get_vfo returns VFOA/VFOB/Main/Sub"),
611 c.ok(lines) && kValidVfos.contains(vfo), vfo);
612
613 // 4.2 set_vfo
614 lines = c.send(QStringLiteral("\\set_vfo VFOA"));
615 r.check(QStringLiteral("4.2 set_vfo VFOA returns RPRT 0"), c.ok(lines));
616
617 // 4.3 / 4.4 vfo_op UP then DOWN — verify step-size movement
618 const QStringList stepLines = c.send(QStringLiteral("\\get_ts"));
619 const QString stepStr = c.field(stepLines, QStringLiteral("Tuning Step"));
620 const qint64 step = stepStr.toLongLong();
621
622 const qint64 freqBefore =
623 c.field(c.send(QStringLiteral("\\get_freq")), QStringLiteral("Frequency")).toLongLong();
624
625 c.send(QStringLiteral("\\vfo_op UP"));
626 qint64 freqUp = 0;
627 {
628 QElapsedTimer t; t.start();
629 do {
630 freqUp = c.field(c.send(QStringLiteral("\\get_freq")),
631 QStringLiteral("Frequency")).toLongLong();
632 if (qAbs(freqUp - (freqBefore + step)) <= 1 || t.elapsed() >= 1000) break;
633 QThread::msleep(100);
634 } while (true);
635 }
636 // PASS on an exact one-step move; SKIP when the radio quantizes/clamps the
637 // step to its own grid (the same constraint 4.8b/14.2b skip for); FAIL only
638 // if the frequency did not move up at all (a real vfo_op regression).
639 {
640 const QString d = QStringLiteral("before=%1 after=%2 step=%3")
641 .arg(freqBefore).arg(freqUp).arg(step);
642 const QString name = QStringLiteral("4.3 vfo_op UP increases frequency by one tuning step");
643 if (step > 0 && qAbs(freqUp - (freqBefore + step)) <= 1)
644 r.check(name, true, d);
645 else if (freqUp > freqBefore)
646 r.skip(name, QStringLiteral("radio quantized/constrained step; %1").arg(d));
647 else
648 r.check(name, false, d);
649 }
650
651 c.send(QStringLiteral("\\vfo_op DOWN"));
652 qint64 freqDown = 0;
653 {
654 QElapsedTimer t; t.start();
655 do {

Callers 1

mainFunction · 0.70

Calls 10

isIntFunction · 0.85
containsMethod · 0.80
isNullMethod · 0.80
sectionMethod · 0.45
sendMethod · 0.45
fieldMethod · 0.45
checkMethod · 0.45
okMethod · 0.45
startMethod · 0.45
skipMethod · 0.45

Tested by

no test coverage detected