File tree Expand file tree Collapse file tree 6 files changed +157
-0
lines changed
Expand file tree Collapse file tree 6 files changed +157
-0
lines changed Original file line number Diff line number Diff line change 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 >
Original file line number Diff line number Diff line change 1+ package liquidjava .api .tests ;
2+
3+ import static org .junit .Assert .assertFalse ;
4+ import static org .junit .Assert .assertNotNull ;
5+
6+ import liquidjava .api .CommandLineLauncher ;
7+ import liquidjava .errors .ErrorEmitter ;
8+ import org .junit .Test ;
9+
10+ public class TesteIntegrationSimples {
11+
12+ @ Test
13+ public void testLaunchOnSimpleExample () {
14+ String path = "../liquidjava-example/src/main/java/testSuite/SimpleTest.java" ;
15+
16+ ErrorEmitter ee = CommandLineLauncher .launch (path );
17+ assertNotNull ("nao pode ser null" , ee );
18+ assertFalse ("não é esperado nenhum erro de verificacao" , ee .foundError ());
19+ }
20+ }
Original file line number Diff line number Diff line change 1+ package liquidjava .ast .opt ;
2+
3+ import static org .junit .Assert .assertEquals ;
4+
5+ import org .junit .Test ;
6+
7+ import liquidjava .rj_language .ast .BinaryExpression ;
8+ import liquidjava .rj_language .ast .LiteralInt ;
9+ import liquidjava .rj_language .opt .ConstantFolding ;
10+ import liquidjava .rj_language .opt .derivation_node .ValDerivationNode ;
11+
12+ public class TestOptimization {
13+ @ Test
14+ public void testBinaryFold () {
15+ BinaryExpression b = new BinaryExpression (new LiteralInt (1 ), "+" , new LiteralInt (2 ));
16+
17+ ValDerivationNode r = ConstantFolding .fold (new ValDerivationNode (b , null ));
18+ assertEquals (r .getValue (), new LiteralInt (3 ));
19+ }
20+ }
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 1+ package liquidjava .rj_language .ast ;
2+
3+ import static org .junit .Assert .*;
4+
5+ import org .junit .Test ;
6+
7+ public class LiteralBooleanHashCodeTest {
8+
9+ @ Test
10+ public void sameValue_sameHashCode_andEquals () {
11+ LiteralBoolean a = new LiteralBoolean (true );
12+ LiteralBoolean b = new LiteralBoolean (true );
13+ assertEquals (a , b );
14+ assertEquals (a .hashCode (), b .hashCode ());
15+ }
16+
17+ @ Test
18+ public void differentValues_differentHashCodes () {
19+ LiteralBoolean a = new LiteralBoolean (true );
20+ LiteralBoolean b = new LiteralBoolean (false );
21+ assertNotEquals (a , b );
22+ assertNotEquals (a .hashCode (), b .hashCode ());
23+ }
24+
25+ @ Test
26+ public void clone_preservesEqualityAndHashCode () {
27+ LiteralBoolean a = new LiteralBoolean (false );
28+ LiteralBoolean c = (LiteralBoolean ) a .clone ();
29+ assertEquals (a , c );
30+ assertEquals (a .hashCode (), c .hashCode ());
31+ }
32+ }
Original file line number Diff line number Diff line change 1+ package liquidjava .rj_language .ast ;
2+
3+ import static org .junit .Assert .*;
4+
5+ import org .junit .Test ;
6+
7+ public class TestHashLitReal {
8+
9+ @ Test
10+ public void sameValue_sameHashCode_andEquals () {
11+ LiteralReal a = new LiteralReal (3.14 );
12+ LiteralReal b = new LiteralReal (3.14 );
13+ assertEquals (a , b );
14+ assertEquals (a .hashCode (), b .hashCode ());
15+ }
16+
17+ @ Test
18+ public void differentValues_differentHashCodes () {
19+ LiteralReal a = new LiteralReal (1.0 );
20+ LiteralReal b = new LiteralReal (2.0 );
21+ assertNotEquals (a , b );
22+ assertNotEquals (a .hashCode (), b .hashCode ());
23+ }
24+
25+ @ Test
26+ public void clone_preservesEqualityAndHashCode () {
27+ LiteralReal a = new LiteralReal (-42.5 );
28+ LiteralReal c = (LiteralReal ) a .clone ();
29+ assertEquals (a , c );
30+ assertEquals (a .hashCode (), c .hashCode ());
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments