Exemplo n.º 1
0
 def test_subtracting_one(self) -> None:
     e = BinaryExpr(
         NumberExpr(10, 11, 0, 10),
         BinaryOp("-"),
         NumberExpr(100, 101, 1, 10),
     )
     assert expr_add_one(e) == NumberExpr(10, 11, 0, 10)
Exemplo n.º 2
0
 def test_non_decimal_number(self, display_base: int) -> None:
     e = NumberExpr(100, 103, 123, display_base)
     assert expr_add_one(e) == BinaryExpr(
         NumberExpr(100, 103, 123, display_base),
         BinaryOp("+"),
         NumberExpr(100, 100, 1, 10),
     )
Exemplo n.º 3
0
 def test_subtracting_decimal_number(self) -> None:
     e = BinaryExpr(
         NumberExpr(10, 11, 0, 10),
         BinaryOp("-"),
         NumberExpr(100, 103, 123, 10),
     )
     assert expr_add_one(e) == BinaryExpr(
         NumberExpr(10, 11, 0, 10),
         BinaryOp("-"),
         NumberExpr(100, 103, 122, 10),
     )
Exemplo n.º 4
0
 def test_other_values(self, expr: Expr) -> None:
     assert expr_add_one(expr) == BinaryExpr(
         expr,
         BinaryOp("+"),
         NumberExpr(10, 10, 1, 10),
     )
Exemplo n.º 5
0
 def test_decimal_number(self) -> None:
     e = NumberExpr(100, 103, 123, 10)
     assert expr_add_one(e) == NumberExpr(100, 103, 124, 10)