Skip to content

Conversation

@iamamirsalehi
Copy link
Contributor

@iamamirsalehi iamamirsalehi commented May 14, 2025

This pull request adds unit tests for the util package, specifically covering the following functions:

  • Atoi
  • ParseInt
  • ParseUint
  • ParseFloat

These tests validate both valid and invalid input cases to improve confidence in parsing logic and ensure correct error handling.


Test Coverage

The tests include:

  • Basic positive and negative integer conversions
  • Base-10, base-16, and base-36 parsing
  • Unsigned integers and invalid (e.g., negative for uint)
  • Float parsing, including special values like NaN
  • Expected errors for malformed or invalid inputs

Motivation

Adding test coverage for utility parsing functions helps ensure correctness and guards against regressions in future changes. These are low-level helpers that are widely used internally, so ensuring their reliability is critical.


Checklist

  • Unit tests added
  • Follows repository conventions and naming
  • No breaking changes introduced
@ndyakov
Copy link
Member

ndyakov commented May 14, 2025

Thank you @iamamirsalehi!

@ndyakov ndyakov self-requested a review May 14, 2025 14:31
Copy link
Member

@ndyakov ndyakov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you.

@iamamirsalehi
Copy link
Contributor Author

Thanks for your review

@ndyakov ndyakov merged commit 43e7fb5 into redis:master May 15, 2025
16 checks passed
ofekshenawa pushed a commit to ofekshenawa/go-redis that referenced this pull request Jun 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants