@@ -9,29 +9,27 @@ public class EndianConverterTest {
9
9
10
10
@ ParameterizedTest
11
11
@ 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
17
15
})
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
21
20
assertEquals (expected , EndianConverter .littleToBigEndian (input ));
22
21
}
23
22
24
23
@ ParameterizedTest
25
24
@ 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
31
28
})
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
35
33
assertEquals (expected , EndianConverter .bigToLittleEndian (input ));
36
34
}
37
35
}
0 commit comments