Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions liquidjava-verifier/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,45 @@
<build>
<finalName>${jar.finalName}</finalName>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.14</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>default-check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>COMPLEXITY</counter>
<value>COVEREDRATIO</value>
<minimum>0.60</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package liquidjava.api.tests;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;

import liquidjava.api.CommandLineLauncher;
import liquidjava.errors.ErrorEmitter;
import org.junit.Test;

public class TesteIntegrationSimples {

@Test
public void testLaunchOnSimpleExample() {
String path = "../liquidjava-example/src/main/java/testSuite/SimpleTest.java";

ErrorEmitter ee = CommandLineLauncher.launch(path);
assertNotNull("nao pode ser null", ee);
assertFalse("não é esperado nenhum erro de verificacao", ee.foundError());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package liquidjava.rj_language;

import static org.junit.Assert.assertNotEquals;
import org.junit.Test;
import liquidjava.rj_language.ast.LiteralString;

public class TestLiteralString {
@Test
public void testLiteralString() {
LiteralString s1 = new LiteralString("hello");
LiteralString s2 = new LiteralString("world");
assertNotEquals(s1.hashCode(), s2.hashCode());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package liquidjava.rj_language.ast;

import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;

class BinaryExpressionBasicsTest {

@Test
void testeOperacaoAritmetica() {
BinaryExpression be = new BinaryExpression(new LiteralInt(1), "+", new LiteralInt(2));

assertTrue(be.isArithmeticOperation());
assertFalse(be.isBooleanOperation());
assertFalse(be.isLogicOperation());

assertEquals("1 + 2", be.toString());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import static org.junit.Assert.assertEquals;

import org.junit.Test;

import liquidjava.rj_language.ast.BinaryExpression;
import liquidjava.rj_language.ast.LiteralInt;
import liquidjava.rj_language.opt.ConstantFolding;
import liquidjava.rj_language.opt.derivation_node.ValDerivationNode;

public class TestOptimization {
@Test
public void testBinaryFold() {
BinaryExpression b = new BinaryExpression(new LiteralInt(1), "+", new LiteralInt(2));

ValDerivationNode r = ConstantFolding.fold(new ValDerivationNode(b, null));
assertEquals(r.getValue(), new LiteralInt(3));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package liquidjava.rj_language.ast;

import org.junit.jupiter.api.Test;

import java.util.ArrayList;
import java.util.List;

import static org.junit.jupiter.api.Assertions.*;

class VarBasicsTest {

@Test
void testeNome_Clone() {
Var v = new Var("x"); //metodos similares retornam o mesmo

assertEquals("x", v.getName(), "Nome var");
assertEquals("x", v.toString(), "toString deve devolver o nome");

Var vClone = (Var) v.clone(); //mesmo objeto mas dif instancia
assertNotSame(v, vClone, "clone deve ser outra instância");
assertEquals(v, vClone, "clone deve ser igual ao original");
}
}
Loading