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 @@ -213,6 +213,45 @@
<!-- <autoPublish>true</autoPublish> -->
</configuration>
</plugin>
<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>
</plugins>
</build>

Expand Down
17 changes: 17 additions & 0 deletions liquidjava-verifier/src/test/java/liquidjava/ast/opt/TestIte.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import liquidjava.rj_language.ast.LiteralInt;
import liquidjava.rj_language.ast.Ite;

public class TestIte {
@Test
public void testIte() {
LiteralInt i1 = new LiteralInt(3);
LiteralInt i2 = new LiteralInt(3);

Ite ite1 = new Ite(i1, i1, i1);
Ite ite2 = new Ite(i2, i2, i2);

assertEquals(ite1.hashCode(), ite2.hashCode());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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,16 @@
package liquidjava.diagnostics;

import static org.junit.Assert.assertTrue;
import org.junit.Test;

public class TestLJDiagnostic {
@Test
public void testGetTitle() {
String title1 = "title";
String title2 = "fake title";
LJDiagnostic ljd = new LJDiagnostic(title1, null, null, null, null);

assertTrue(ljd.getTitle().equals(title1));
assertTrue(!ljd.getTitle().equals(title2));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package liquidjava.rj_language.ast;

import static org.junit.Assert.assertTrue;
import org.junit.Test;
import java.util.Arrays;

public class TestFunctionInvocation {
@Test
public void testFunctionInvocationEqualsAndHashcode() {
Expression exp1 = new LiteralString("./testFiles/file.txt");
Expression exp2 = new LiteralString("./testFiles/file_fake.txt");

FunctionInvocation f1 = new FunctionInvocation("java.nio.file.Paths.get", Arrays.asList(exp1));
FunctionInvocation f2 = new FunctionInvocation("java.nio.file.Paths.get", Arrays.asList(exp1));
FunctionInvocation f3 = new FunctionInvocation("java.nio.file.Paths.get", Arrays.asList(exp2));

assertTrue(f1.equals(f2) && !f1.equals(f3));
assertTrue(f1.hashCode() == f2.hashCode() && f1.hashCode() != f3.hashCode());
}

}
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());
}
}
Loading