Skip to content
Open
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
Empty file modified liquidjava
100755 → 100644
Empty file.
44 changes: 42 additions & 2 deletions liquidjava-verifier/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>liquidjava.api.CommandLineLauncher</mainClass>
</transformer>
</transformers>
Expand All @@ -95,6 +96,45 @@
</execution>
</executions>
</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.5</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -206,4 +246,4 @@
</dependency>
</dependencies>
</dependencyManagement>
</project>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package liquidjava.ast.opt;

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.ast.UnaryExpression;
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));
}

@Test
public void testUnaryExpression() {
UnaryExpression u = new UnaryExpression("-", new LiteralInt(3));
ValDerivationNode vd = ConstantFolding.fold(new ValDerivationNode(u, null));
assertEquals(vd.getValue(), new LiteralInt(-3));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
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,13 @@
package liquidjava.rj_language;

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

public class TestPredicate {

@Test
public void testCreateInvocation() {
Predicate p = Predicate.createInvocation("test", Predicate.createVar("x"));
assertEquals("test(x)", p.getExpression().toString());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package liquidjava.rj_language;

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

import liquidjava.rj_language.ast.LiteralBoolean;

public class testLiteralBoolean {

@Test
public void testLiteralBoolean() {
LiteralBoolean s1 = new LiteralBoolean(true);
LiteralBoolean s2 = new LiteralBoolean(false);
assertNotEquals(s1.hashCode(), s2.hashCode());
}
}