@Test
    public void testAdd() {

		Assert.assertEquals(addr(0, 8), space.add(addr(0, 5), 3));
		Assert.assertEquals(addr(10, 1), space.add(addr(10, 5), -4));
		Assert.assertEquals(addr(0xffff, 0xffff), space.add(addr(0, 0), 0x10FFEF));

		try {
			space.add(addr(0, 1), 0x10FFEF);
			Assert.fail();
		}
		catch (AddressOutOfBoundsException e) {
		}

		try {
			Assert.assertEquals(addr(2, 8), space.addNoWrap(addr(2, 5), 3));
			Assert.assertEquals(addr(0, 1), space.addNoWrap(addr(0, 5), -4));
		}
		catch (AddressOverflowException e) {
			Assert.fail(e.getMessage());
		}

		try {
			space.addNoWrap(addr(0xffff, 5), 0x10000);
			Assert.fail("Should not have gotten a value!");
		}
		catch (AddressOverflowException e) {
		}

	}
To change this generated comment edit the template variable "typecomment":
Window>Preferences>Java>Templates.
Ghidra/Framework/SoftwareModeling/src/test/java/ghidra/program/model/address/SegmentedAddressSpaceTest.java