1 byte issue in TuneReadWriteTest #1512

fixing first issue
This commit is contained in:
rusefi 2020-06-18 11:51:52 -04:00
parent f33189db69
commit 647a672aa6
2 changed files with 9 additions and 4 deletions

View File

@ -159,12 +159,18 @@ public class Field {
if (bitOffset != NO_BIT_OFFSET) {
int packed = wrapped.getInt();
value = (packed >> bitOffset) & 1;
} else if (type == INT8 || type == UINT8) {
} else if (type == INT8) {
value = wrapped.get();
} else if (type == UINT8) {
byte signed = wrapped.get();
value = signed & 0xFF;
} else if (type == INT) {
value = wrapped.getInt();
} else if (type == INT16 || type == UINT16) {
} else if (type == INT16) {
value = wrapped.getShort();
} else if (type == UINT16) {
short signed = wrapped.getShort();
value = signed & 0xFFFF;
} else {
value = wrapped.getFloat();
}

View File

@ -57,8 +57,7 @@ public class TuneReadWriteTest {
ConfigurationImage binaryDataFromXml = tuneFromFile.asImage(IniFileModel.getInstance());
// todo: why one byte mismatch? since it's in floats I kind of do not care, floats are weird
assertEquals(1, compareImages(originalBinaryData, binaryDataFromXml));
assertEquals(0, compareImages(originalBinaryData, binaryDataFromXml));
Files.delete(path);
}