Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: expand testing of augmented assignment operators #70

Merged
merged 2 commits into from
Jul 5, 2024

Conversation

ee7
Copy link
Contributor

@ee7 ee7 commented Jul 4, 2024

Add some more tests for augmented assignment operators, and remove some existing ones that had similar coverage.

assignops.c4m was similar to basic10.c4m:

"""
Basic test of augmented assignment.
"""
"""
$output:
45
"""
x = 0
for i in 0 to 10 {
x += i
}
print(x)

The grammar specifies the augmented assignment operators here:

libcon4m/doc/reference.md

Lines 443 to 445 in b4fdc8e

assign ::= expression assignmentOp expression EOS
assignmentOp ::= ':' | '=' | '+=' | '-=' | '*=' | '/=' | '|=' | '&=' |
'^=' | '>>=' | '<<='

Note that commit b4fdc8e changed the behavior of the /= operator so that:

  • For division by zero, SIGFPE is no longer produced.
  • For division by a negative number, the result is now correct.

Refs: #55
Refs: #57
Refs: #71

@ee7 ee7 force-pushed the ee7/tests-assignops branch from 160dffd to 2b3cb69 Compare July 4, 2024 11:15
ee7 added 2 commits July 4, 2024 13:38
Add some more tests for augmented assignment operators, and remove some
existing ones that had similar coverage.

assignops.c4m was similar to basic10.c4m:

    """
    Basic test of augmented assignment.
    """
    """
    $output:
    45
    """

    x = 0

    for i in 0 to 10 {
      x  += i
    }

    print(x)

The grammar specifies the augmented assignment operators here:

    assign       ::= expression assignmentOp expression EOS
    assignmentOp ::= ':' | '=' | '+=' | '-=' | '*=' | '/=' | '|=' | '&=' | '^=' | '>>=' | '<<='

Note that commit b4fdc8e (2024-07-03, "Reworking of lists, etc")
changed the behavior of the /= operator so that:

- For division by zero, SIGFPE is no longer produced.

- For division by a negative number, the result is now correct.

Refs: #55
Refs: #57
@ee7 ee7 force-pushed the ee7/tests-assignops branch from 2b3cb69 to 20fd250 Compare July 4, 2024 11:38
@ee7 ee7 marked this pull request as ready for review July 4, 2024 11:56
@ee7 ee7 requested a review from viega July 5, 2024 05:54
@ee7 ee7 merged commit fa231d8 into main Jul 5, 2024
2 checks passed
@ee7 ee7 deleted the ee7/tests-assignops branch July 5, 2024 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants