This commit is contained in:
rusefi 2020-05-31 13:18:47 -04:00
parent f8b6378e94
commit 42a69be638
2 changed files with 6 additions and 29 deletions

View File

@ -1,29 +1,16 @@
package com.rusefi.core.test;
import com.rusefi.core.SensorCentral;
import com.rusefi.core.EngineState;
import com.rusefi.io.LinkDecoder;
import org.junit.Ignore;
import org.junit.Test;
import java.util.concurrent.atomic.AtomicInteger;
import static com.rusefi.core.EngineState.SEPARATOR;
import static junit.framework.Assert.*;
import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;
/**
* @author Andrey Belomutskiy
* 12/26/12
*/
public class EngineStateTest {
@Test
public void packUnpack() {
String a = "rpm,100,";
String packed = EngineState.packString(a);
assertEquals("line:8:rpm,100,", packed);
assertEquals(a, LinkDecoder.TEXT_PROTOCOL_DECODER.unpack(packed));
}
@Test
public void startsWithIgnoreCase() {
assertTrue(EngineState.startWithIgnoreCase("HELLO", "he"));

View File

@ -7,19 +7,9 @@ import com.rusefi.core.EngineState;
* 6/20/2015.
*/
public interface LinkDecoder {
LinkDecoder TEXT_PROTOCOL_DECODER = new LinkDecoder() {
@Override
public String unpack(String packet) {
return EngineState.unpackString(packet);
}
};
LinkDecoder VOID = new LinkDecoder() {};
LinkDecoder VOID = new LinkDecoder() {
@Override
public String unpack(String packet) {
return packet;
}
};
String unpack(String packet);
default String unpack(String packet) {
return packet;
}
}