@@ -9,29 +9,27 @@ public class EndianConverterTest {
99
1010 @ ParameterizedTest
1111 @ CsvSource ({
12- "0x78563412, 0x12345678" ,
13- "0x00000000, 0x00000000" ,
14- "0x00000001, 0x01000000" ,
15- "0xFFFFFFFF, 0xFFFFFFFF" , // -1 in two's complement
16- "0x0000007F, 0x7F000000" // Positive boundary case
12+ "0x78563412, 0x12345678" , "0x00000000, 0x00000000" , "0x00000001, 0x01000000" ,
13+ "0xFFFFFFFF, 0xFFFFFFFF" , // -1 in two's complement
14+ "0x0000007F, 0x7F000000" // Positive boundary case
1715 })
18- public void testLittleToBigEndian (String inputHex , String expectedHex ) {
19- int input = (int ) Long .parseLong (inputHex .substring (2 ), 16 ); // Convert hex string to int
20- int expected = (int ) Long .parseLong (expectedHex .substring (2 ), 16 ); // Convert hex string to int
16+ public void
17+ testLittleToBigEndian (String inputHex , String expectedHex ) {
18+ int input = (int ) Long .parseLong (inputHex .substring (2 ), 16 ); // Convert hex string to int
19+ int expected = (int ) Long .parseLong (expectedHex .substring (2 ), 16 ); // Convert hex string to int
2120 assertEquals (expected , EndianConverter .littleToBigEndian (input ));
2221 }
2322
2423 @ ParameterizedTest
2524 @ CsvSource ({
26- "0x12345678, 0x78563412" ,
27- "0x00000000, 0x00000000" ,
28- "0x01000000, 0x00000001" ,
29- "0xFFFFFFFF, 0xFFFFFFFF" , // -1 in two's complement
30- "0x7F000000, 0x0000007F" // Positive boundary case
25+ "0x12345678, 0x78563412" , "0x00000000, 0x00000000" , "0x01000000, 0x00000001" ,
26+ "0xFFFFFFFF, 0xFFFFFFFF" , // -1 in two's complement
27+ "0x7F000000, 0x0000007F" // Positive boundary case
3128 })
32- public void testBigToLittleEndian (String inputHex , String expectedHex ) {
33- int input = (int ) Long .parseLong (inputHex .substring (2 ), 16 ); // Convert hex string to int
34- int expected = (int ) Long .parseLong (expectedHex .substring (2 ), 16 ); // Convert hex string to int
29+ public void
30+ testBigToLittleEndian (String inputHex , String expectedHex ) {
31+ int input = (int ) Long .parseLong (inputHex .substring (2 ), 16 ); // Convert hex string to int
32+ int expected = (int ) Long .parseLong (expectedHex .substring (2 ), 16 ); // Convert hex string to int
3533 assertEquals (expected , EndianConverter .bigToLittleEndian (input ));
3634 }
3735}
0 commit comments