@Test
	public void testRegisterRefDiffs() throws Exception {
		// 0x10018a6: p1 has reg ref to esi.
		// 0x100295a: p2 has reg ref to cx.
		// 0x1002cf5: p1 has reg ref to edi; p2 has reg ref to eax.
		// 0x10033f6: p1 & p2 both have reg ref to edi.

		Register esiReg1 = p1.getRegister("ESI");
		Register ediReg1 = p1.getRegister("EDI");

		int transactionID1 = p1.startTransaction("Test Transaction");
		ReferenceManager refManager1 = p1.getReferenceManager();
		refManager1.addRegisterReference(addr(p1, "0x10018a6"), 0, esiReg1, RefType.DATA,
			SourceType.USER_DEFINED);

		refManager1.addRegisterReference(addr(p1, "0x1002cf5"), 0, ediReg1, RefType.DATA,
			SourceType.USER_DEFINED);

		refManager1.addRegisterReference(addr(p1, "0x10033f6"), 0, ediReg1, RefType.DATA,
			SourceType.USER_DEFINED);
		p1.endTransaction(transactionID1, true);

		ReferenceManager referenceManager2 = p2.getReferenceManager();
		Register cxReg2 = p2.getRegister("CX");
		Register ediReg2 = p2.getRegister("EDI");
		Register eaxReg2 = p2.getRegister("EAX");

		int transactionID2 = p2.startTransaction("Test Transaction");
		referenceManager2.addRegisterReference(addr(p2, "0x100295a"), 0, cxReg2, RefType.DATA,
			SourceType.USER_DEFINED);

		referenceManager2.addRegisterReference(addr(p2, "0x1002cf5"), 0, eaxReg2, RefType.DATA,
			SourceType.USER_DEFINED);

		referenceManager2.addRegisterReference(addr(p2, "0x10033f6"), 0, ediReg2, RefType.DATA,
			SourceType.USER_DEFINED);
		p2.endTransaction(transactionID2, true);

		programDiff = new ProgramDiff(p1, p2);
		programDiff.setFilter(new ProgramDiffFilter(ProgramDiffFilter.REFERENCE_DIFFS));
		AddressSet expectedDiffs = new AddressSet();
		expectedDiffs.addRange(addr(0x010018a6), addr(0x010018a6));
		expectedDiffs.addRange(addr(0x1002cf5), addr(0x1002cf5));
		expectedDiffs.addRange(addr(0x0100295a), addr(0x0100295a));
		assertEquals(expectedDiffs, programDiff.getDifferences(programDiff.getFilter(), null));
	}
Test that ProgramDiff can determine the stack reference differences
between Program1 and Program2.
Ghidra/Features/Base/src/test.slow/java/ghidra/program/util/ProgramDiff4Test.java