Skip to content

Commit 3bc33d2

Browse files
committed
Testes unitários e de integração adicionados - fc59848
1 parent f0ab2f9 commit 3bc33d2

File tree

3 files changed

+84
-0
lines changed

3 files changed

+84
-0
lines changed

liquidjava-verifier/pom.xml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,45 @@
1919
<build>
2020
<finalName>${jar.finalName}</finalName>
2121
<plugins>
22+
<plugin>
23+
<groupId>org.jacoco</groupId>
24+
<artifactId>jacoco-maven-plugin</artifactId>
25+
<version>0.8.14</version>
26+
<executions>
27+
<execution>
28+
<id>default-prepare-agent</id>
29+
<goals>
30+
<goal>prepare-agent</goal>
31+
</goals>
32+
</execution>
33+
<execution>
34+
<id>default-report</id>
35+
<goals>
36+
<goal>report</goal>
37+
</goals>
38+
</execution>
39+
<execution>
40+
<id>default-check</id>
41+
<goals>
42+
<goal>check</goal>
43+
</goals>
44+
<configuration>
45+
<rules>
46+
<rule>
47+
<element>BUNDLE</element>
48+
<limits>
49+
<limit>
50+
<counter>COMPLEXITY</counter>
51+
<value>COVEREDRATIO</value>
52+
<minimum>0.60</minimum>
53+
</limit>
54+
</limits>
55+
</rule>
56+
</rules>
57+
</configuration>
58+
</execution>
59+
</executions>
60+
</plugin>
2261
<plugin>
2362
<groupId>net.revelc.code.formatter</groupId>
2463
<artifactId>formatter-maven-plugin</artifactId>
@@ -98,6 +137,8 @@
98137
</plugins>
99138
</build>
100139

140+
141+
101142
<properties>
102143
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
103144
<maven.compiler.source>20</maven.compiler.source>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package liquidjava.rj_language;
2+
3+
import static org.junit.Assert.assertNotEquals;
4+
import static org.junit.Assert.assertTrue;
5+
import static org.junit.Assert.assertFalse;
6+
import org.junit.Test;
7+
import liquidjava.rj_language.ast.LiteralString;
8+
9+
public class TestLiteralString {
10+
@Test
11+
public void testLiteralString() {
12+
LiteralString s1 = new LiteralString("hello");
13+
LiteralString s2 = new LiteralString("world");
14+
assertNotEquals(s1.hashCode(), s2.hashCode());
15+
}
16+
17+
@Test
18+
public void testLiteralStringEquals() {
19+
LiteralString s1 = new LiteralString("hello");
20+
LiteralString s2 = new LiteralString("world");
21+
LiteralString s3 = new LiteralString("hello");
22+
assertTrue(s1.equals(s3));
23+
assertFalse(s1.equals(s2));
24+
}
25+
}
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)