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

ToInt64 now throws exception when appropriate #1360

Merged
merged 4 commits into from
Jun 13, 2019
Merged

ToInt64 now throws exception when appropriate #1360

merged 4 commits into from
Jun 13, 2019

Conversation

MateuszKlatecki
Copy link
Member

@MateuszKlatecki MateuszKlatecki commented Jun 12, 2019

Description

Convert function didn't throw exceptions if value in input string isn't correct number or is out of range and returns 0 in above situation. After this change exceptions are thrown.

Motivation and Context

  • Fixes problem with incorrect parse integers

How Has This Been Tested?

I wrote a simple program that tests various possibilities. I can add it to example programs.
There is still problem during UInt64 and Int64 Parse. If value is out of range function didn't throw exception but return maximal or minimal allowed value.

Sample output:
ConverterTestOutput.txt

Screenshots

Types of changes

  • Improvement (non-breaking change that improves a feature, code or algorithm)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Signed-off-by: GITHUB_USER <GITHUB_USER_EMAIL>

…rect number or is out of range

(cherry picked from commit ff0975b0c3f352ac3bea71aa16eca2f3635c72f5)
@nfbot
Copy link
Member

nfbot commented Jun 12, 2019

Hi @MateuszKlatecki,

I'm nanoFramework bot.
Thank you for your contribution!

A human will be reviewing it shortly. 😉

@josesimoes josesimoes added Area: Common libs Everything related with common libraries Type: enhancement labels Jun 12, 2019
@josesimoes josesimoes changed the title Convert function throws exceptions ToInt64 now throws exception when appropriate Jun 12, 2019
@josesimoes
Copy link
Member

@MateuszKlatecki yes please add some test code to the samples.
Also copy/paste the output in the PR comment above, please. Just to keep a record of the output.

Copy link
Member

@josesimoes josesimoes left a comment

Choose a reason for hiding this comment

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

LGTM!

@josesimoes josesimoes merged commit d9b5000 into nanoframework:develop Jun 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Common libs Everything related with common libraries Type: enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants