@Test
	public void test8051CodeUnitIterator() throws Exception {

		program.release(this);
		ProgramBuilder builder = new ProgramBuilder("8051", ProgramBuilder._8051, this);

		builder.createMemory("CODE", "CODE:0100", 0x100);
		builder.createMemory("EXTMEM", "EXTMEM:0000", 0x100);
		builder.createMemory("SFR", "SFR:0000", 0x100);

		for (int i = 0; i < 10; i++) {
			builder.applyDataType("CODE:010" + i, ByteDataType.dataType, 1);
		}

		for (int i = 0; i < 10; i++) {
			builder.applyDataType("EXTMEM:000" + i, ByteDataType.dataType, 1);
		}

		for (int i = 0; i < 10; i++) {
			builder.applyDataType("SFR:000" + i, ByteDataType.dataType, 1);
		}

		program = builder.getProgram();

		// make sure we can get an interator over multiple address spaces
		CodeUnitIterator iter = program.getListing().getCodeUnits(true);
		int cnt = 0;
		while (iter.hasNext()) {
			iter.next();
			++cnt;
		}
		assertEquals(0x300, cnt);
	}
** Diagnostic Aid ** Open program in tool
@throws Exception
Ghidra/Features/Base/src/test.slow/java/ghidra/program/database/code/CodeUnitIteratorTest.java