assertEquals(false, result.isSigned());
}
- /**
- * Test that IntegerDeclaration throws when constructing a signed 1 bit
- * declaration
- */
- @Test(expected = java.lang.IllegalArgumentException.class)
- public void testIntegerDeclarationIllegalArgSignedBit() {
- int len = 1;
- boolean signed = true;
- int base = 1;
- ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
- Encoding encoding = Encoding.ASCII;
- IntegerDeclaration.createDeclaration(len, signed, base, byteOrder, encoding, "", 16);
- }
-
- /**
- * Test that IntegerDeclaration throws when constructing a invalid length
- * declaration
- */
- @Test(expected = java.lang.IllegalArgumentException.class)
- public void testIntegerDeclarationIllegalArgBadLenght() {
- int len = 0;
- boolean signed = false;
- int base = 1;
- ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
- Encoding encoding = Encoding.ASCII;
- IntegerDeclaration.createDeclaration(len, signed, base, byteOrder, encoding, "", 16);
- }
-
/**
* Test the factory part more rigorously to make sure there are no
* regressions
*/
private IntegerDeclaration(int len, boolean signed, int base,
@Nullable ByteOrder byteOrder, Encoding encoding, String clock, long alignment) {
- if (len <= 0 || len == 1 && signed) {
- throw new IllegalArgumentException();
- }
-
fLength = len;
fSigned = signed;
fBase = base;