@Test
	public void testBlock4() throws IOException {
		BinaryReader br = br((byte) 0, (byte) 0, (byte) 0, (byte) 1, (byte) 0x55, (byte) 0,
			(byte) 0, (byte) 0, (byte) 0);

		DWARFAttributeValue result = read(br, DW_AT_byte_size, DW_FORM_block4);
		assertTrue("Should be block", result instanceof DWARFBlobAttribute);
		assertEquals("should be 1", 1, ((DWARFBlobAttribute) result).getLength());
		assertEquals("should be 0x55", 0x55, ((DWARFBlobAttribute) result).getBytes()[0]);

		result = read(br, DW_AT_byte_size, DW_FORM_block4);
		assertTrue("Should be block", result instanceof DWARFBlobAttribute);
		assertEquals("should be 0", 0, ((DWARFBlobAttribute) result).getLength());

		// Test max block4 sized chunk
		byte[] bytes = new byte[4 + DWARFForm.MAX_BLOCK4_SIZE];
		//DWARFAttributeFactory.MAX_BLOCK4_SIZE == 0x00_10_00_00
		bytes[0] = (byte) 0x00;
		bytes[1] = (byte) 0x10;
		bytes[2] = (byte) 0x00;
		bytes[3] = (byte) 0x00;
		result = read(br(bytes), DW_AT_byte_size, DW_FORM_block4);
		assertTrue("Should be block", result instanceof DWARFBlobAttribute);
		assertEquals("should be MAX_BLOCK4_SIZE", DWARFForm.MAX_BLOCK4_SIZE,
			((DWARFBlobAttribute) result).getLength());

		// Test block4 size that is larger than max
		bytes = new byte[4 + DWARFForm.MAX_BLOCK4_SIZE + 1];
		//DWARFAttributeFactory.MAX_BLOCK4_SIZE == 0x00_10_00_00 + 1 == 0x00_10_00_01
		bytes[0] = (byte) 0x00;
		bytes[1] = (byte) 0x10;
		bytes[2] = (byte) 0x00;
		bytes[3] = (byte) 0x01;
		try {
			result = read(br(bytes), DW_AT_byte_size, DW_FORM_block4);
			fail(
				"Should not get here, dw_form_block4 size should have been larger than max sanity check");
		}
		catch (IOException ioe) {
			// good
		}
	}
Test reading binary representations of DWARF attributes from raw bytes.
Ghidra/Features/Base/src/test/java/ghidra/app/util/bin/format/dwarf/attribs/DWARFAttributeFactoryTest.java