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.isShidIntAdd; import static org.shedlang.compiler.shid.instructions.ShidMatchers.isShidPushInt; import static org.zwobble.precisely.AssertThat.assertThat; import static org.zwobble.precisely.Matchers.isSequence; public class ShidCodeGenIntAddTests { @Test public void intAddIsCompiledToIntAddInstruction() { var node = Typed.intAdd( 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), isShidIntAdd() )); } }