@Test
	public void testGetCodeUnitsSet() throws Exception {

		AddressSet set = new AddressSet();
		set.addRange(addr(0x3ec), addr(0x3f3));
		set.addRange(addr(0x3fc), addr(0x404));
		set.addRange(addr(0x409), addr(0x40b));

		CodeUnitIterator it = listing.getCodeUnits(set, true);

		for (int i = 0; i < 3; i++) {
			CodeUnit cu = it.next();
			assertEquals(addr(0x3ec + i), cu.getMinAddress());
			assertTrue(cu instanceof Data);
		}
		CodeUnit cu = it.next();
		assertEquals(addr(0x3ef), cu.getMinAddress());
		assertTrue(cu instanceof Instruction);

		cu = it.next();
		assertEquals(addr(0x3f1), cu.getMinAddress());
		assertTrue(cu instanceof Data);

		cu = it.next();
		assertEquals(addr(0x3f2), cu.getMinAddress());
		assertTrue(cu instanceof Instruction);

		for (int i = 0; i < 3; i++) {
			cu = it.next();
			assertEquals(addr(0x3ff + i), cu.getMinAddress());
			assertTrue(cu instanceof Data);
		}

		cu = it.next();
		assertEquals(addr(0x402), cu.getMinAddress());
		assertTrue(cu instanceof Instruction);

		cu = it.next();
		assertEquals(addr(0x404), cu.getMinAddress());
		assertTrue(cu instanceof Data);

		for (int i = 0; i < 3; i++) {
			cu = it.next();
			assertEquals(addr(0x409 + i), cu.getMinAddress());
			assertTrue(cu instanceof Data);
		}

		assertFalse(it.hasNext());
		assertNull(it.next());
	}
** Diagnostic Aid ** Open program in tool
@throws Exception
Ghidra/Features/Base/src/test.slow/java/ghidra/program/database/code/CodeUnitIteratorTest.java