@Test
	public void testReplaceDelaySlotInstructions() throws Exception {
		mtf.initialize("r4000", new ProgramModifierListener() {

			@Override
			public void modifyLatest(ProgramDB program) {
				//Empty
			}

			@Override
			public void modifyPrivate(ProgramDB program) {
				// P2 program
				Listing listing = program.getListing();
				Instruction instr = listing.getInstructionAt(addr(program, "0x808c"));
				instr.setFlowOverride(FlowOverride.BRANCH);
				instr = listing.getInstructionAt(addr(program, "0x8090"));
				instr.setFallThrough(null);
				instr = listing.getInstructionAt(addr(program, "0x8098"));
				instr.setFallThrough(null);
				instr = listing.getInstructionAt(addr(program, "0x80b4"));
				instr.setFlowOverride(FlowOverride.CALL);
			}
		});

		p1 = mtf.getResultProgram();
		p2 = mtf.getPrivateProgram();

		int txId = p1.startTransaction("Merge into Program 1");
		try {
			AddressSet setToDiff = new AddressSet();
			setToDiff.addRange(addr(p1, "0x8080"), addr(p1, "0x80d0"));
			programMerge = new ProgramMergeManager(p1, p2, setToDiff);

			//programMerge.setDiffFilter(new ProgramDiffFilter(ProgramDiffFilter.SYMBOL_DIFFS));
			programMerge.setMergeFilter(
				new ProgramMergeFilter(ProgramMergeFilter.ALL, ProgramMergeFilter.REPLACE));
			AddressSet expectedDiffs = new AddressSet();
			expectedDiffs.addRange(addr(p1, "0x808c"), addr(p1, "0x8093"));
			expectedDiffs.addRange(addr(p1, "0x8098"), addr(p1, "0x809b"));
			expectedDiffs.addRange(addr(p1, "0x80b4"), addr(p1, "0x80b7"));
			assertEquals(expectedDiffs, programMerge.getFilteredDifferences());

			assertTrue(programMerge.merge(expectedDiffs, TaskMonitor.DUMMY));
		}
		finally {
			p1.endTransaction(txId, true);
		}

		Listing resultListing = p1.getListing();
		Listing sourceListing = p2.getListing();

		Instruction sourceInstr = sourceListing.getInstructionAt(addr(p1, "0x808c"));
		Instruction resultInstr = resultListing.getInstructionAt(addr(p1, "0x808c"));
		assertNotNull(resultInstr);
		assertEquals(sourceInstr.getPrototype(), resultInstr.getPrototype());
		assertEquals(sourceInstr.getFlowOverride(), resultInstr.getFlowOverride());
		assertEquals(sourceInstr.getFallThrough(), resultInstr.getFallThrough());

		sourceInstr = sourceListing.getInstructionAt(addr(p1, "0x8090"));
		resultInstr = resultListing.getInstructionAt(addr(p1, "0x8090"));
		assertNotNull(resultInstr);
		assertEquals(sourceInstr.getPrototype(), resultInstr.getPrototype());
		assertEquals(sourceInstr.getFlowOverride(), resultInstr.getFlowOverride());
		assertEquals(sourceInstr.getFallThrough(), resultInstr.getFallThrough());

		sourceInstr = sourceListing.getInstructionAt(addr(p1, "0x8094"));
		resultInstr = resultListing.getInstructionAt(addr(p1, "0x8094"));
		assertNotNull(resultInstr);
		assertEquals(sourceInstr.getPrototype(), resultInstr.getPrototype());
		assertEquals(sourceInstr.getFlowOverride(), resultInstr.getFlowOverride());
		assertEquals(sourceInstr.getFallThrough(), resultInstr.getFallThrough());

		sourceInstr = sourceListing.getInstructionAt(addr(p1, "0x8098"));
		resultInstr = resultListing.getInstructionAt(addr(p1, "0x8098"));
		assertNotNull(resultInstr);
		assertEquals(sourceInstr.getPrototype(), resultInstr.getPrototype());
		assertEquals(sourceInstr.getFlowOverride(), resultInstr.getFlowOverride());
		assertEquals(sourceInstr.getFallThrough(), resultInstr.getFallThrough());

		sourceInstr = sourceListing.getInstructionAt(addr(p1, "0x80b4"));
		resultInstr = resultListing.getInstructionAt(addr(p1, "0x80b4"));
		assertNotNull(resultInstr);
		assertEquals(sourceInstr.getPrototype(), resultInstr.getPrototype());
		assertEquals(sourceInstr.getFlowOverride(), resultInstr.getFlowOverride());
		assertEquals(sourceInstr.getFallThrough(), resultInstr.getFallThrough());

		sourceInstr = sourceListing.getInstructionAt(addr(p1, "0x80b8"));
		resultInstr = resultListing.getInstructionAt(addr(p1, "0x80b8"));
		assertNotNull(resultInstr);
		assertEquals(sourceInstr.getPrototype(), resultInstr.getPrototype());
		assertEquals(sourceInstr.getFlowOverride(), resultInstr.getFlowOverride());
		assertEquals(sourceInstr.getFallThrough(), resultInstr.getFallThrough());

	}
<CODE>ProgramMerge2Test</CODE> tests the <CODE>ProgramMerge</CODE> class
to verify it correctly merges various types of program differences.
The tests modify copies of the same program to cause differences
between these two programs, which can then be merged.
Ghidra/Features/Base/src/test.slow/java/ghidra/program/util/ProgramMerge2Test.java