🐐 Negation
This commit is contained in:
6
tests.py
6
tests.py
@@ -8,7 +8,7 @@ from centvrion.ast_nodes import (
|
||||
Bool, BinOp, BuiltIn, DataArray, DataRangeArray, Defini,
|
||||
Designa, DumStatement, Erumpe, ExpressionStatement, ID,
|
||||
Invoca, ModuleCall, Nullus, Numeral, PerStatement,
|
||||
Program, Redi, SiStatement, String,
|
||||
Program, Redi, SiStatement, String, UnaryMinus,
|
||||
num_to_int, int_to_num, make_string,
|
||||
)
|
||||
from centvrion.lexer import Lexer
|
||||
@@ -105,6 +105,10 @@ arithmetic_tests = [
|
||||
("X / III", None, ValInt(3)), # integer division: 10 // 3 = 3
|
||||
("II + III * IV", None, ValInt(14)), # precedence: 2 + (3*4) = 14
|
||||
("(II + III) * IV", None, ValInt(20)), # parens: (2+3)*4 = 20
|
||||
("- III", None, ValInt(-3)), # unary negation
|
||||
("- (II + III)", None, ValInt(-5)), # unary negation of expression
|
||||
("- - II", None, ValInt(2)), # double negation
|
||||
("III + - II", None, ValInt(1)), # unary in binary context
|
||||
]
|
||||
|
||||
class TestArithmetic(unittest.TestCase):
|
||||
|
||||
Reference in New Issue
Block a user