Skip to content

Commit dadcad6

Browse files
committed
Adicionar testes
1 parent f0ab2f9 commit dadcad6

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed

liquidjava-verifier/pom.xml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,50 @@
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>
137+
138+
98139
</plugins>
140+
141+
99142
</build>
100143

101144
<properties>
@@ -207,3 +250,4 @@
207250
</dependencies>
208251
</dependencyManagement>
209252
</project>
253+
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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import static org.junit.Assert.assertEquals;
2+
import org.junit.Test;
3+
4+
import liquidjava.rj_language.ast.BinaryExpression;
5+
import liquidjava.rj_language.ast.LiteralInt;
6+
import liquidjava.rj_language.opt.ConstantFolding;
7+
import liquidjava.rj_language.opt.derivation_node.ValDerivationNode;
8+
9+
public class TestOptimization {
10+
@Test
11+
public void testBinaryFold() {
12+
BinaryExpression b = new BinaryExpression(new LiteralInt(1), "+", new LiteralInt(2));
13+
ValDerivationNode r = ConstantFolding.fold(new ValDerivationNode(b, null));
14+
assertEquals(r.getValue(), new LiteralInt(3));
15+
}
16+
}

0 commit comments

Comments
 (0)