Commit f52709ca authored by Bram Kohlen's avatar Bram Kohlen
Browse files

Basic framework for tests

parent 4735f812
Pipeline #60729 passed with stages
in 1 minute and 11 seconds
package de.monticore.lang.monticar.mpp.montimath;
import de.monticore.ast.ASTNode;
import de.monticore.commonexpressions._ast.*;
import de.monticore.expressionsbasis._ast.ASTExpression;
import de.monticore.lang.math._ast.*;
import de.monticore.lang.matrix._ast.ASTMathMatrixAccessExpression;
import de.monticore.lang.matrix._ast.ASTMathMatrixValueExplicitExpression;
......
package de.monticore.lang.monticar.mpp.models;
import de.monticore.lang.math._ast.ASTMathCompilationUnit;
import de.monticore.lang.math._parser.MathParser;
import de.monticore.lang.monticar.mpp.montimath.MathPrettyPrinter;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Optional;
import static junit.framework.TestCase.*;
public abstract class AbstractModelTest {
protected MathPrettyPrinter printer;
public AbstractModelTest()
{
this(new MathPrettyPrinter());
}
public AbstractModelTest(MathPrettyPrinter printer)
{
this.printer = printer;
}
public String printVanillaModel(String name) throws IOException
{
Path model = Paths.get("src/test/resources/models/montimath/vanilla/" + name).toAbsolutePath();
MathParser parser = new MathParser();
Optional<ASTMathCompilationUnit> astOptional = parser.parse(model.toString());
assertTrue(astOptional.isPresent());
return printer.prettyPrint(astOptional.get());
}
}
package de.monticore.lang.monticar.mpp.models;
import org.junit.Ignore;
import org.junit.Test;
import java.io.IOException;
public class NestedTest extends AbstractModelTest {
@Test
@Ignore
public void printTest() throws IOException
{
System.out.println(printVanillaModel("Nested.m"));
}
}
......@@ -11,8 +11,8 @@ script Nested
else
for j = 1:2:6
sum += sum * (i - j);
end;
end;
end
end
end;
end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment