@Test
	public void testRestrictedAddressSet() throws Exception {
		programBuilder1.createMemory("d1", "0x100", 0x100, null, (byte) 0xAC);
		programBuilder1.createMemory("d2", "0x200", 0x100);
		programBuilder1.createLabel("0x01006420", "Function1");
		programBuilder1.createComment("0x010059a3", "Here we are.", CommentType.EOL);

		programBuilder2.createMemory("d1", "0x100", 0x100, null, (byte) 0xAF);
		programBuilder2.createMemory("d4", "0x400", 0x100);
		programBuilder2.createLabel("0x01006420", "Function2");
		programBuilder2.createComment("0x010059a3", "There you have it.", CommentType.EOL);

		programDiff = new ProgramDiff(p1, p2);
		programDiff.setFilter(new ProgramDiffFilter(ProgramDiffFilter.ALL_DIFFS));
		AddressSetView diffs;

		// before restricting it should detect diffs.
		diffs = programDiff.getDifferences(TaskMonitor.DUMMY);
		assertTrue(diffs.contains(addr(p1, 0x01006420)));
		assertTrue(diffs.contains(addr(p1, 0x010059a3)));

		// restricted set is initially null.
		assertNull(programDiff.getRestrictedAddressSet());

		// must be in restricted set to be returned.
		programDiff.setRestrictedAddressSet(
			new AddressSet(addr(p1, 0x01002239), addr(p1, 0x0100248c)));
		AddressSet as = new AddressSet();
		as.addRange(addr(p1, 0x01002239), addr(p1, 0x0100248c));
		assertEquals(as, programDiff.getRestrictedAddressSet());

		// ignore set is used by the Diff.
		diffs = programDiff.getDifferences(new ProgramDiffFilter(ProgramDiffFilter.ALL_DIFFS),
			TaskMonitor.DUMMY);
		assertTrue(!diffs.contains(addr(p1, 0x01006420)) && !diffs.contains(addr(p1, 0x010059a3)));

		// restricted set can be cleared.
		programDiff.removeRestrictedAddressSet();
		assertNull(programDiff.getRestrictedAddressSet());
	}
Test that ProgramDiff correctly restricts the Diff results to an address set.
Ghidra/Features/Base/src/test.slow/java/ghidra/program/util/ProgramDiff4Test.java