Skip to content

Commit

Permalink
Combine integer comparison tests into the same file (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
Akuli authored Jan 24, 2023
1 parent 93226de commit 8eb58bd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,24 @@ def side_effect(n: int) -> int:
return n

def main() -> int:
printf("%d\n", 2*3 == 6) # Output: 1
printf("%d\n", 2*3 == 7) # Output: 0
printf("%d\n", 6 == 2*3) # Output: 1
printf("%d\n", 7 == 2*3) # Output: 0

printf("%d\n", 2*3 != 6) # Output: 0
printf("%d\n", 2*3 != 7) # Output: 1
printf("%d\n", 6 != 2*3) # Output: 0
printf("%d\n", 7 != 2*3) # Output: 1

printf("%d %d %d %d\n", 1 < 1, 1 < 2, 2 < 1, 2 < 2) # Output: 0 1 0 0
printf("%d %d %d %d\n", 1 > 1, 1 > 2, 2 > 1, 2 > 2) # Output: 0 0 1 0
printf("%d %d %d %d\n", 1 <= 1, 1 <= 2, 2 <= 1, 2 <= 2) # Output: 1 1 0 1
printf("%d %d %d %d\n", 1 >= 1, 1 >= 2, 2 >= 1, 2 >= 2) # Output: 1 0 1 1

# Check evaluation order.
printf("%d\n", side_effect(5) == side_effect(6)) # Output: 5 6 0
printf("%d\n", side_effect(5) != side_effect(6)) # Output: 5 6 1
printf("%d\n", side_effect(5) < side_effect(6)) # Output: 5 6 1
printf("%d\n", side_effect(5) <= side_effect(6)) # Output: 5 6 1
printf("%d\n", side_effect(5) > side_effect(6)) # Output: 5 6 0
Expand Down
22 changes: 0 additions & 22 deletions tests/should_succeed/eq_ne.jou

This file was deleted.

0 comments on commit 8eb58bd

Please sign in to comment.