use of de.invesdwin.context.matlab.runtime.contract.AScriptTaskMatlab in project invesdwin-context-matlab by subes.
the class HelloWorldScript method testHelloWorld.
public void testHelloWorld() {
final AScriptTaskMatlab<String> script = new AScriptTaskMatlab<String>() {
@Override
public void populateInputs(final IScriptTaskInputs inputs) {
inputs.putString("hello", "World");
}
@Override
public void executeScript(final IScriptTaskEngine engine) {
// execute this script inline:
// engine.eval("world = strcat({'Hello '}, hello, '!')");
// or run it from a file:
engine.eval(new ClassPathResource(HelloWorldScript.class.getSimpleName() + ".m", getClass()));
}
@Override
public String extractResults(final IScriptTaskResults results) {
return results.getString("world");
}
};
final String result = script.run(runner);
Assertions.assertThat(result).isEqualTo("Hello World!");
}
use of de.invesdwin.context.matlab.runtime.contract.AScriptTaskMatlab in project invesdwin-context-matlab by subes.
the class HelloWorldScript method testHelloWorld.
public void testHelloWorld() {
final AScriptTaskMatlab<String> script = new AScriptTaskMatlab<String>() {
@Override
public void populateInputs(final IScriptTaskInputs inputs) {
inputs.putString("hello", "World");
}
@Override
public void executeScript(final IScriptTaskEngine engine) {
// execute this script inline:
// engine.eval("world = strcat('Hello ', hello, '!')");
// or run it from a file:
engine.eval(new ClassPathResource(HelloWorldScript.class.getSimpleName() + ".sce", getClass()));
}
@Override
public String extractResults(final IScriptTaskResults results) {
return results.getString("world");
}
};
final String result = script.run(runner);
Assertions.assertThat(result).isEqualTo("Hello World!");
}
Aggregations