Skip to content

Commit 08d91d4

Browse files
committed
Passo5
1 parent fdff1c5 commit 08d91d4

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
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)