@Test public void testArrayModel() { ArrayModel amodel = new ArrayModel(); amodel.setName("fred"); amodel.setPositions(0.1); assertEquals( // Concise. "val('fred', 0.1)", pyExpress(amodel, false)); assertEquals( // Verbose. "array(axis='fred', values=[0.1])", pyExpress(amodel, true)); amodel.setPositions(0.1, 0.2); assertEquals( // Concise but with n>1 array values. "array('fred', [0.1, 0.2])", pyExpress(amodel, false)); }
@Test public void testCompoundScanRequest() throws Exception { StepModel smodel = new StepModel(); smodel.setStart(0); smodel.setStop(10); smodel.setStep(1); smodel.setName("fred"); ArrayModel amodel = new ArrayModel(); amodel.setName("fred"); amodel.setPositions(0.1); ScanRequest<IROI> request = new ScanRequest<>(); request.setCompoundModel(new CompoundModel(smodel, amodel)); assertEquals( // Concise. "mscan([step('fred', 0.0, 10.0, 1.0), val('fred', 0.1)])", pyExpress(request, false)); assertEquals( // Verbose. "mscan(path=[step(axis='fred', start=0.0, stop=10.0, step=1.0), array(axis='fred', values=[0.1])])", pyExpress(request, true)); }