Skip to content

Commit 48af60a

Browse files
committed
adicionados teste unitário TestLiteralInt e teste de integração TestOptimization
1 parent f0ab2f9 commit 48af60a

File tree

3 files changed

+71
-0
lines changed

3 files changed

+71
-0
lines changed

liquidjava-verifier/pom.xml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,45 @@
9595
</execution>
9696
</executions>
9797
</plugin>
98+
<plugin>
99+
<groupId>org.jacoco</groupId>
100+
<artifactId>jacoco-maven-plugin</artifactId>
101+
<version>0.8.14</version>
102+
<executions>
103+
<execution>
104+
<id>default-prepare-agent</id>
105+
<goals>
106+
<goal>prepare-agent</goal>
107+
</goals>
108+
</execution>
109+
<execution>
110+
<id>default-report</id>
111+
<goals>
112+
<goal>report</goal>
113+
</goals>
114+
</execution>
115+
<execution>
116+
<id>default-check</id>
117+
<goals>
118+
<goal>check</goal>
119+
</goals>
120+
<configuration>
121+
<rules>
122+
<rule>
123+
<element>BUNDLE</element>
124+
<limits>
125+
<limit>
126+
<counter>COMPLEXITY</counter>
127+
<value>COVEREDRATIO</value>
128+
<minimum>0.60</minimum>
129+
</limit>
130+
</limits>
131+
</rule>
132+
</rules>
133+
</configuration>
134+
</execution>
135+
</executions>
136+
</plugin>
98137
</plugins>
99138
</build>
100139

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package liquidjava.rj_language;
2+
3+
import static org.junit.Assert.assertNotEquals;
4+
import org.junit.Test;
5+
import liquidjava.rj_language.ast.LiteralString;
6+
7+
public class TestLiteralString {
8+
@Test
9+
public void testLiteralString() {
10+
LiteralString s1 = new LiteralString("hello");
11+
LiteralString s2 = new LiteralString("world");
12+
assertNotEquals(s1.hashCode(), s2.hashCode());
13+
}
14+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import static org.junit.Assert.assertEquals;
2+
3+
import org.junit.Test;
4+
5+
import liquidjava.rj_language.ast.BinaryExpression;
6+
import liquidjava.rj_language.ast.LiteralInt;
7+
import liquidjava.rj_language.opt.ConstantFolding;
8+
import liquidjava.rj_language.opt.derivation_node.ValDerivationNode;
9+
10+
public class TestOptimization {
11+
@Test
12+
public void testBinaryFold() {
13+
BinaryExpression b = new BinaryExpression(new LiteralInt(1), "+", new LiteralInt(2));
14+
15+
ValDerivationNode r = ConstantFolding.fold(new ValDerivationNode(b, null));
16+
assertEquals(r.getValue(), new LiteralInt(3));
17+
}
18+
}

0 commit comments

Comments
 (0)