Skip to content

Commit 9e16c08

Browse files
committed
Added integer conversion test
1 parent fc408ef commit 9e16c08

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/test/java/de/rub/nds/modifiablevariable/util/ArrayConverterTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,4 +261,15 @@ public void testBigIntegerReconversion() {
261261
assertEquals(b, c);
262262
}
263263
}
264+
265+
@Test
266+
public void testIntegerReconversion() {
267+
Random r = new Random(0);
268+
for (int i = 0; i < 10000; i++) {
269+
Integer b = r.nextInt();
270+
byte[] intBytes = ArrayConverter.intToBytes(b, 4);
271+
Integer c = ArrayConverter.bytesToInt(intBytes);
272+
assertEquals(b, c);
273+
}
274+
}
264275
}

0 commit comments

Comments
 (0)