blob: f89dd48d4e2f2e39c25c143115e7ffc4b30c4c1b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package org.shedlang.compiler.shid;
import org.junit.jupiter.api.Test;
import org.shedlang.compiler.ast.typed.Typed;
import static org.shedlang.compiler.shid.instructions.ShidMatchers.*;
import static org.zwobble.precisely.AssertThat.assertThat;
import static org.zwobble.precisely.Matchers.isSequence;
public class ShidCodeGenIntGreaterThanTests {
@Test
public void intGreaterThanIsCompiledToIntGreaterThanInstruction() {
var node = Typed.intGreaterThan(
Typed.intLiteral(42),
Typed.intLiteral(47)
);
var context = ShidCodeGen.Context.EMPTY;
var result = ShidCodeGen.compileExpression(node, context);
assertThat(result.instructions(), isSequence(
isShidPushInt(42),
isShidPushInt(47),
isShidIntGreaterThan()
));
}
}
|