Skip to content

Commit

Permalink
Testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
mihxil committed Nov 10, 2024
1 parent 44c7e27 commit 346a98e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mihxil-math/src/main/java/org/meeuw/math/DigitUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -421,14 +421,14 @@ public static String digitToString(byte b) {

}

private static byte[] stringToDigits(String s) {
public static byte[] stringToDigits(String s) {
byte[] result = new byte[s.length()];
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(s.length() - 1 - i);
if (c >= '0' && c <= '9') {
result[i] = (byte) (c - '0');
} else {
result[i] = (byte) (c - 'a');
result[i] = (byte) (c - 'a' + 10);
}
}
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ public void basic() {
})
public void digitToString(int digit, String s) {
assertThat(DigitUtils.digitToString((byte) digit)).isEqualTo(s);
assertThat(DigitUtils.stringToDigits(s)).containsExactly((byte) digit);

}


Expand Down

0 comments on commit 346a98e

Please sign in to comment.