Skip to content

Add support for testing large return values (> 255) #232

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

Merged
merged 1 commit into from
Aug 6, 2025
Merged

Conversation

jserv
Copy link
Collaborator

@jserv jserv commented Aug 5, 2025

Previously, test suite was limited to verifying return values between 0-255 due to Unix exit code constraints. It made testing functions with larger return values awkward, requiring workarounds like "(fib(16) - 987) == 0".

This commit introduces a new try_large() function that:

  • Wraps test code in a test_function() that returns the value to test
  • Uses printf to output the return value instead of exit codes
  • Compares the printed output against expected values

Close #152

Summary by Bito

This pull request enhances the testing framework by introducing the try_large function, which allows for testing return values exceeding 255. This modification addresses limitations of Unix exit codes, enabling more accurate function output verification.

@jserv jserv requested a review from fennecJ August 5, 2025 13:41
Previously, test suite was limited to verifying return values between
0-255 due to Unix exit code constraints. It made testing functions with
larger return values awkward, requiring workarounds like
"(fib(16) - 987) == 0".

This commit introduces a new try_large() function that:
- Wraps test code in a test_function() that returns the value to test
- Uses printf to output the return value instead of exit codes
- Compares the printed output against expected values

Close #152
@fennecJ
Copy link
Collaborator

fennecJ commented Aug 6, 2025

Looks good to me. This approach using printf makes it easier for future contributors to extend support to non-integer types if needed. It also allows us to test the printf formatting of large integers (e.g., %x, %o).

@jserv jserv merged commit 41f5f07 into master Aug 6, 2025
12 checks passed
@jserv jserv deleted the extend-tests branch August 6, 2025 05:01
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.

Improve test suite for a broader range of cases more efficiently
2 participants