def test_number_being_divided_is_parsed(): assert ( do_parse("3/d") == [ Modify(sym="d", op="/", value=Number("3")) ] )
def test_multiplying_by_variable_is_parsed(): assert ( do_parse("aa~s") == [ Modify(sym="s", op="", value=Symbol("aa")) ] )
def test_number_being_subtracted_is_parsed(): assert ( do_parse("3-d") == [ Modify(sym="d", op="-", value=Number("3")) ] )
def test_function_call_passed_to_operator_is_parsed(): assert ( do_parse(":R~+d") == [ Modify(sym="d", op="+", value=FunctionCall(Symbol("R"))) ] )
def test_assignment_is_parsed(): assert ( do_parse("3=d") == [ Modify(sym="d", op="=", value=Number("3")) ] )
def test_number_being_added_is_parsed(): assert ( do_parse("3+d") == [ Modify(sym="d", op="+", value=Number("3")) ] )
def test_number_being_multiplied_is_parsed(): assert ( do_parse("3.5d") == [ Modify(sym="d", op="", value=Number("3.5")) ] )
def test_function_call_then_increment_is_parsed(): assert ( do_parse(":S+d") == [ FunctionCall(Symbol("S")), Modify(sym="d", op="+", value=Number("10")) ] )
def test_function_call_then_add_is_parsed(): assert ( do_parse(":S95+d") == [ FunctionCall(Symbol("S")), Modify(sym="d", op="+", value=Number("95")) ] )
def test_function_def_assigned(): assert ( do_parse("{+d:S}=x") == [ Modify( sym="x", op="=", value=FunctionDef( [ Modify( sym="d", op="+", value=Number("10"), ), FunctionCall(Symbol("S")), ] ), ), ] )
def test_continuation_extends_previous_item_into_next(): assert ( do_parse(":R~+d:S") == [ Modify( sym="d", op="+", value=FunctionCall(Symbol("R")), ), FunctionCall(Symbol("S")), ] )
def test_negative_number_in_middle_of_other_expressions_is_parsed(): assert ( do_parse(":S-3+d") == [ FunctionCall(Symbol("S")), Modify( sym="d", op="+", value=Number("3", negative=True) ) ] )
def test_nonempty_function_def(): assert ( do_parse("{+d:S}") == [ FunctionDef( [ Modify( sym="d", op="+", value=Number("10"), ), FunctionCall(Symbol("S")), ] ), ] )