MCPcopy Create free account
hub / github.com/IChooseYou/Reclass / testBaseAddressSpan

Method testBaseAddressSpan

tests/test_editor.cpp:716–752  ·  view source on GitHub ↗

── Test: CommandRow ADDR span is valid ──

Source from the content-addressed store, hash-verified

714
715 // ── Test: CommandRow ADDR span is valid ──
716 void testBaseAddressSpan() {
717 m_editor->applyDocument(m_result);
718
719 // Set CommandRow text with ADDR value (simulates controller)
720 m_editor->setCommandRowText(
721 QStringLiteral("source\u25BE \u00B7 0xD87B5E5000"));
722
723 // Line 0 is CommandRow
724 const LineMeta* lm = m_editor->metaForLine(0);
725 QVERIFY(lm);
726 QCOMPARE(lm->lineKind, LineKind::CommandRow);
727
728 // Get CommandRow line text
729 QString lineText;
730 int len = (int)m_editor->scintilla()->SendScintilla(
731 QsciScintillaBase::SCI_LINELENGTH, (unsigned long)0);
732 if (len > 0) {
733 QByteArray buf(len + 1, '\0');
734 m_editor->scintilla()->SendScintilla(
735 QsciScintillaBase::SCI_GETLINE, (unsigned long)0, (void*)buf.data());
736 lineText = QString::fromUtf8(buf.constData(), len);
737 while (lineText.endsWith('\n') || lineText.endsWith('\r'))
738 lineText.chop(1);
739 }
740
741 // ADDR span should be valid (uses commandRowAddrSpan)
742 ColumnSpan as = commandRowAddrSpan(lineText);
743 QVERIFY2(as.valid, "ADDR span should be valid on CommandRow");
744 QVERIFY(as.start < as.end);
745
746 // The span should cover the hex address
747 QString spanText = lineText.mid(as.start, as.end - as.start);
748 QVERIFY2(spanText.contains("0x") || spanText.startsWith("0X"),
749 qPrintable("Span should contain hex address, got: " + spanText));
750
751 m_editor->applyDocument(m_result);
752 }
753
754 // ── Test: Padding line rejects value editing ──
755 void testPaddingLineRejectsValueEdit() {

Callers

nothing calls this directly

Calls 5

commandRowAddrSpanFunction · 0.85
applyDocumentMethod · 0.80
setCommandRowTextMethod · 0.80
metaForLineMethod · 0.80
scintillaMethod · 0.80

Tested by

no test coverage detected