added operator '%' (division remainder) and test

This commit is contained in:
2024-03-26 09:27:14 +01:00
parent 594806c999
commit 998580772a
2 changed files with 40 additions and 0 deletions
+4
View File
@@ -187,6 +187,10 @@ func TestParser(t *testing.T) {
/* 79 */ {`1 / 2`, int64(0), nil},
/* 80 */ {`1.0 / 2`, float64(0.5), nil},
/* 81 */ {`1 ./ 2`, float64(0.5), nil},
/* 82 */ {`5 % 2`, int64(1), nil},
/* 83 */ {`5 % (-2)`, int64(1), nil},
/* 84 */ {`-5 % 2`, int64(-1), nil},
/* 85 */ {`5 % 2.0`, nil, errors.New(`left operand '5' [int64] is not compatible with right operand '2' [float64] with respect to operator "%"`)},
}
parser := NewParser(ctx)