arturobernalg commented on code in PR #877:
URL: https://github.com/apache/commons-lang/pull/877#discussion_r883071033


##########
src/test/java/org/apache/commons/lang3/ConversionTest.java:
##########
@@ -413,6 +415,29 @@ public void testBinaryBeMsb0ToHexDigit_2args() {
 
     }
 
+    @Test
+    public void testBinaryToHexDigitReverse() {
+        final SplittableRandom rng = new SplittableRandom();
+        final boolean[] x = new boolean[8];
+        for (int i = 0; i < 100; i++) {
+            Conversion.longToBinary(rng.nextLong(), 0, x, 0, 8);
+            for (int j = 1; j <= 8; j++) {
+                final boolean[] a = Arrays.copyOf(x, j);
+                final boolean[] b = a.clone();
+                ArrayUtils.reverse(b);
+                for (int k = 0; k < j; k++) {
+                    assertEquals(Conversion.binaryToHexDigit(a, k),
+                            Conversion.binaryBeMsb0ToHexDigit(b, k));
+                }
+            }
+        }
+    }
+
+    @Test
+    public void binaryBeMsb0ToHexDigitPosOutsideArray() {
+        assertThrows(IndexOutOfBoundsException.class, () -> 
Conversion.binaryBeMsb0ToHexDigit(new boolean[8], 99));

Review Comment:
   done
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to