mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-27 22:43:30 +08:00
refactor: DecimalToHexadecimal
(#5337)
This commit is contained in:
@ -1,14 +0,0 @@
|
||||
package com.thealgorithms.conversions;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class DecimalToHexaDecimalTest {
|
||||
|
||||
@Test
|
||||
public void testDecimalToHexaDecimal() {
|
||||
assertEquals("000000be", DecimalToHexaDecimal.decToHex(190));
|
||||
assertEquals("00000708", DecimalToHexaDecimal.decToHex(1800));
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.thealgorithms.conversions;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.CsvSource;
|
||||
|
||||
public class DecimalToHexadecimalTest {
|
||||
@ParameterizedTest
|
||||
@CsvSource({"0, 0", "1, 1", "10, a", "15, f", "16, 10", "255, ff", "190, be", "1800, 708"})
|
||||
void testDecToHex(int decimal, String expectedHex) {
|
||||
assertEquals(expectedHex, DecimalToHexadecimal.decToHex(decimal));
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user