test coverage related to https://github.com/rusefi/rusefi/issues/3361#issuecomment-987556760
code readability and test readability
This commit is contained in:
parent
d1c0a9fba6
commit
e42cac9fce
|
@ -229,7 +229,8 @@ public class Elm327Connector implements Closeable {
|
|||
public static byte[] byteToString(byte[] hdr, byte[] data, int offset, int payloadLength) {
|
||||
int totalLength = hdr.length + payloadLength;
|
||||
byte[] hexData = new byte[totalLength * 2 + 1];
|
||||
for (int i = 0, j = 0; i < totalLength; i++, j += 2) {
|
||||
for (int i = 0; i < totalLength; i++) {
|
||||
int j = i * 2;
|
||||
int v = ((i < hdr.length) ? hdr[i] : data[i - hdr.length + offset]) & 0xFF;
|
||||
hexData[j] = HEX_ARRAY[v >>> 4];
|
||||
hexData[j + 1] = HEX_ARRAY[v & 0x0F];
|
||||
|
|
|
@ -35,7 +35,9 @@ public class IsoTpConnectorTest {
|
|||
IsoTpConnector.sendStrategy(crcWrappedCrcRequest, testConnector);
|
||||
|
||||
assertEquals(2, packets.size());
|
||||
// 10 0B 50
|
||||
assertEquals("31 30 30 42 30 30 30 35 36 42 30 30 30 30 35 30 0D ", packets.get(0));
|
||||
// 21 5F 69 AF A0 70
|
||||
assertEquals("32 31 35 46 36 39 41 46 41 30 37 30 0D ", packets.get(1));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue