use of jmri.progdebugger.ProgDebugger in project JMRI by JMRI.
the class MultiIndexProgrammerFacadeTest method testWriteReadDoubleIndexed.
public void testWriteReadDoubleIndexed() throws jmri.ProgrammerException, InterruptedException {
ProgDebugger dp = new ProgDebugger();
Programmer p = new MultiIndexProgrammerFacade(dp, "81", "82", true, false);
ProgListener l = new ProgListener() {
@Override
public void programmingOpReply(int value, int status) {
log.debug("callback value=" + value + " status=" + status);
replied = true;
readValue = value;
}
};
p.writeCV("123.45.46", 12, l);
waitReply();
Assert.assertEquals("index 1 written", 45, dp.getCvVal(81));
Assert.assertEquals("index 2 written", 46, dp.getCvVal(82));
Assert.assertEquals("value written", 12, dp.getCvVal(123));
dp.clearHasBeenWritten(81);
dp.clearHasBeenWritten(82);
p.readCV("123.45.46", l);
waitReply();
Assert.assertEquals("read back", 12, readValue);
Assert.assertEquals("index 1 written", 45, dp.getCvVal(81));
Assert.assertEquals("index 2 written", 46, dp.getCvVal(82));
}
use of jmri.progdebugger.ProgDebugger in project JMRI by JMRI.
the class MultiIndexProgrammerFacadeTest method testWriteReadDoubleIndexedSkip.
public void testWriteReadDoubleIndexedSkip() throws jmri.ProgrammerException, InterruptedException {
ProgDebugger dp = new ProgDebugger();
Programmer p = new MultiIndexProgrammerFacade(dp, "81", "82", true, true);
ProgListener l = new ProgListener() {
@Override
public void programmingOpReply(int value, int status) {
log.debug("callback value=" + value + " status=" + status);
replied = true;
readValue = value;
}
};
p.writeCV("123.45.46", 12, l);
waitReply();
Assert.assertEquals("index 1 written", 45, dp.getCvVal(81));
Assert.assertEquals("index 2 written", 46, dp.getCvVal(82));
Assert.assertEquals("value written", 12, dp.getCvVal(123));
dp.clearHasBeenWritten(81);
dp.clearHasBeenWritten(82);
p.readCV("123.45.46", l);
waitReply();
Assert.assertEquals("read back", 12, readValue);
Assert.assertTrue("index 1 not written", !dp.hasBeenWritten(81));
Assert.assertTrue("index 2 not written", !dp.hasBeenWritten(82));
}
use of jmri.progdebugger.ProgDebugger in project JMRI by JMRI.
the class MultiIndexProgrammerFacadeTest method testWriteReadSingleIndexed.
public void testWriteReadSingleIndexed() throws jmri.ProgrammerException, InterruptedException {
ProgDebugger dp = new ProgDebugger();
Programmer p = new MultiIndexProgrammerFacade(dp, "81", "82", true, false);
ProgListener l = new ProgListener() {
@Override
public void programmingOpReply(int value, int status) {
log.debug("callback value=" + value + " status=" + status);
replied = true;
readValue = value;
}
};
p.writeCV("123.45", 12, l);
waitReply();
Assert.assertEquals("index 1 written", 45, dp.getCvVal(81));
Assert.assertTrue("index 2 not written", !dp.hasBeenWritten(82));
Assert.assertEquals("value written", 12, dp.getCvVal(123));
dp.clearHasBeenWritten(81);
dp.clearHasBeenWritten(82);
p.readCV("123.45", l);
waitReply();
Assert.assertEquals("read back", 12, readValue);
Assert.assertEquals("index 1 written", 45, dp.getCvVal(81));
Assert.assertTrue("index 2 not written", !dp.hasBeenWritten(82));
Assert.assertEquals("index written", 45, dp.getCvVal(81));
}
use of jmri.progdebugger.ProgDebugger in project JMRI by JMRI.
the class MultiIndexProgrammerFacadeTest method testWriteReadSingleIndexedCvLastSkip.
public void testWriteReadSingleIndexedCvLastSkip() throws jmri.ProgrammerException, InterruptedException {
ProgDebugger dp = new ProgDebugger();
Programmer p = new MultiIndexProgrammerFacade(dp, "81", "82", false, true);
ProgListener l = new ProgListener() {
@Override
public void programmingOpReply(int value, int status) {
log.debug("callback value=" + value + " status=" + status);
replied = true;
readValue = value;
}
};
p.writeCV("45.123", 12, l);
waitReply();
Assert.assertEquals("index 1 written", 45, dp.getCvVal(81));
Assert.assertTrue("index 2 not written", !dp.hasBeenWritten(82));
Assert.assertEquals("value written", 12, dp.getCvVal(123));
dp.clearHasBeenWritten(81);
dp.clearHasBeenWritten(82);
p.readCV("45.123", l);
waitReply();
Assert.assertEquals("read back", 12, readValue);
Assert.assertTrue("index 1 not written", !dp.hasBeenWritten(81));
Assert.assertTrue("index 2 not written", !dp.hasBeenWritten(82));
}
use of jmri.progdebugger.ProgDebugger in project JMRI by JMRI.
the class MultiIndexProgrammerFacadeTest method testCvLimit.
public void testCvLimit() {
ProgDebugger dp = new ProgDebugger();
dp.setTestReadLimit(1024);
dp.setTestWriteLimit(1024);
Programmer p = new MultiIndexProgrammerFacade(dp, "81", null, true, false);
Assert.assertTrue("CV limit read OK", p.getCanRead("1024"));
Assert.assertTrue("CV limit write OK", p.getCanWrite("1024"));
Assert.assertTrue("CV limit read fail", !p.getCanRead("1025"));
Assert.assertTrue("CV limit write fail", !p.getCanWrite("1025"));
}
Aggregations