Skip to content

fix: safe integer bounds conversion#576

Merged
jkwlui merged 4 commits intogoogleapis:masterfrom
laljikanjareeya:safe-integer-bound-issue
Nov 15, 2019
Merged

fix: safe integer bounds conversion#576
jkwlui merged 4 commits intogoogleapis:masterfrom
laljikanjareeya:safe-integer-bound-issue

Conversation

@laljikanjareeya
Copy link
Contributor

Instead of checking MIN_SAFE_INTEGER and MAX_SAFE_INTEGER condition, Added embedded function Number.isSafeInteger to check safe integer.

  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #575

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Nov 13, 2019
@codecov
Copy link

codecov bot commented Nov 13, 2019

Codecov Report

Merging #576 into master will increase coverage by 0.05%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #576      +/-   ##
==========================================
+ Coverage   86.77%   86.82%   +0.05%     
==========================================
  Files          33       33              
  Lines        1981     1981              
  Branches      349      349              
==========================================
+ Hits         1719     1720       +1     
  Misses        233      233              
+ Partials       29       28       -1
Impacted Files Coverage Δ
src/mutation.ts 92.53% <100%> (+1.49%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ad0d678...6f76dfe. Read the comment docs.

@AVaksman
Copy link
Contributor

AVaksman commented Nov 13, 2019

@laljikanjareeya could you please also add a unit test(s) where {isPossibleNumber: true} is passed, but value to be decoded is outside of bounds of Number (smaller than min, larger then max).

@laljikanjareeya laljikanjareeya force-pushed the safe-integer-bound-issue branch from 9ea1625 to 135c610 Compare November 14, 2019 05:33
@laljikanjareeya
Copy link
Contributor Author

@laljikanjareeya could you please also add a unit test(s) where {isPossibleNumber: true} is passed, but value to be decoded is outside of bounds of Number (smaller than min, larger then max).

@AVaksman Added more unit tests for outside of bounds.

@AVaksman
Copy link
Contributor

LGTM

@jkwlui jkwlui added the automerge Merge the pull request once unit tests and other checks pass. label Nov 15, 2019
@jkwlui jkwlui merged commit a1cd9c0 into googleapis:master Nov 15, 2019
@laljikanjareeya laljikanjareeya deleted the safe-integer-bound-issue branch November 27, 2019 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automerge Merge the pull request once unit tests and other checks pass. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

One-off issue in conversion of INT64 to number

5 participants