Search in sources :

Example 66 with Model

use of abs.frontend.ast.Model in project abstools by abstools.

the class PartialFunctionTest method noErlangCodeGenerated.

@Test
public void noErlangCodeGenerated() throws IOException, NotImplementedYetException {
    Model model = expand(parse("apply(inc)(0);", applyFunction(), incFunction()));
    PartialFunctionDecl func = getPartialFunction(model, "apply");
    assertNotNull(func);
    func.generateErlangCode(null);
}
Also used : Model(abs.frontend.ast.Model) PartialFunctionDecl(abs.frontend.ast.PartialFunctionDecl) Test(org.junit.Test)

Example 67 with Model

use of abs.frontend.ast.Model in project abstools by abstools.

the class PartialFunctionTest method unusedFunctionNotRemoved.

@Test
public void unusedFunctionNotRemoved() {
    Model model = expand(parse("", "def Int f()() = 0;"));
    PartialFunctionDecl decl = getPartialFunction(model, "f");
    assertNotNull("Unused pardef 'f' has been removed!", decl);
}
Also used : Model(abs.frontend.ast.Model) PartialFunctionDecl(abs.frontend.ast.PartialFunctionDecl) Test(org.junit.Test)

Example 68 with Model

use of abs.frontend.ast.Model in project abstools by abstools.

the class PartialFunctionTest method noDynamicJavaCodeGenerated.

@Test
public void noDynamicJavaCodeGenerated() throws NotImplementedYetException, UnsupportedEncodingException {
    Model model = expand(parse("apply(inc)(0);", applyFunction(), incFunction()));
    PartialFunctionDecl func = getPartialFunction(model, "apply");
    assertNotNull(func);
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    func.generateJavaDynamic(new PrintStream(os));
    assertEquals("", os.toString("utf-8"));
}
Also used : PrintStream(java.io.PrintStream) Model(abs.frontend.ast.Model) ByteArrayOutputStream(java.io.ByteArrayOutputStream) PartialFunctionDecl(abs.frontend.ast.PartialFunctionDecl) Test(org.junit.Test)

Example 69 with Model

use of abs.frontend.ast.Model in project abstools by abstools.

the class PartialFunctionTest method noMaudeCodeGenerated.

@Test
public void noMaudeCodeGenerated() throws NotImplementedYetException, UnsupportedEncodingException {
    Model model = testExpand(parse("apply(inc)(0);", applyFunction(), incFunction()), "Apply_%s_inc");
    PartialFunctionDecl func = getPartialFunction(model, "apply");
    assertNotNull(func);
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    func.generateMaude(new PrintStream(os));
    assertEquals("", os.toString("utf-8"));
}
Also used : PrintStream(java.io.PrintStream) Model(abs.frontend.ast.Model) ByteArrayOutputStream(java.io.ByteArrayOutputStream) PartialFunctionDecl(abs.frontend.ast.PartialFunctionDecl) Test(org.junit.Test)

Example 70 with Model

use of abs.frontend.ast.Model in project abstools by abstools.

the class RecoverTest method intfTest2.

@Test
public void intfTest2() {
    Model m = assertParseError(" interface I class C { }");
    assertContainsDeclWithName(m, "I");
}
Also used : Model(abs.frontend.ast.Model) Test(org.junit.Test) FrontendTest(abs.frontend.FrontendTest)

Aggregations

Model (abs.frontend.ast.Model)224 Test (org.junit.Test)170 FrontendTest (abs.frontend.FrontendTest)93 ClassDecl (abs.frontend.ast.ClassDecl)57 DeltaDecl (abs.frontend.ast.DeltaDecl)30 SemanticConditionList (abs.frontend.analyser.SemanticConditionList)24 FunctionDecl (abs.frontend.ast.FunctionDecl)15 PrintStream (java.io.PrintStream)14 ModifyClassModifier (abs.frontend.ast.ModifyClassModifier)12 SkipStmt (abs.frontend.ast.SkipStmt)11 AbsNature (org.absmodels.abs.plugin.builder.AbsNature)11 ExpFunctionDef (abs.frontend.ast.ExpFunctionDef)9 ModuleDecl (abs.frontend.ast.ModuleDecl)9 CompilationUnit (abs.frontend.ast.CompilationUnit)7 DeltaTraitModifier (abs.frontend.ast.DeltaTraitModifier)7 ModifyMethodModifier (abs.frontend.ast.ModifyMethodModifier)7 PartialFunctionDecl (abs.frontend.ast.PartialFunctionDecl)7 PureExp (abs.frontend.ast.PureExp)7 TraitExpr (abs.frontend.ast.TraitExpr)7 WrongProgramArgumentException (abs.common.WrongProgramArgumentException)6