diff --git a/pkg/vm/tests/binary_expr_test.go b/pkg/vm/tests/binary_expr_test.go index 257132bff..3cf5c242d 100644 --- a/pkg/vm/tests/binary_expr_test.go +++ b/pkg/vm/tests/binary_expr_test.go @@ -39,6 +39,17 @@ var binaryExprTestCases = []testCase{ `, big.NewInt(1), }, + { + "simple mod", + ` + package testcase + func Main() int { + x := 3 % 2 + return x + } + `, + big.NewInt(1), + }, { "simple mul", ` @@ -186,6 +197,66 @@ var binaryExprTestCases = []testCase{ `, big.NewInt(1), }, + { + "simple add and assign", + ` + package testcase + func Main() int { + x := 2 + x += 1 + return x + } + `, + big.NewInt(3), + }, + { + "simple sub and assign", + ` + package testcase + func Main() int { + x := 2 + x -= 1 + return x + } + `, + big.NewInt(1), + }, + { + "simple mul and assign", + ` + package testcase + func Main() int { + x := 2 + x *= 2 + return x + } + `, + big.NewInt(4), + }, + { + "simple div and assign", + ` + package testcase + func Main() int { + x := 2 + x /= 2 + return x + } + `, + big.NewInt(1), + }, + { + "simple mod and assign", + ` + package testcase + func Main() int { + x := 5 + x %= 2 + return x + } + `, + big.NewInt(1), + }, } func TestBinaryExprs(t *testing.T) {