ballerina-lang icon indicating copy to clipboard operation
ballerina-lang copied to clipboard

Add validation for decimal values at runtime

Open gabilang opened this issue 2 years ago • 4 comments

Purpose

$title

Fixes #33805

Approach

Determine MIN and MAX values for Ballerina decimal values per IEEE 754 Decimal encoding spec.

Samples

Remarks

Check List

  • [x] Read the Contributing Guide
  • [ ] Updated Change Log
  • [ ] Checked Tooling Support (#<Issue Number>)
  • [ ] Added necessary tests
    • [x] Unit Tests
    • [ ] Spec Conformance Tests
    • [ ] Integration Tests
    • [ ] Ballerina By Example Tests
  • [ ] Increased Test Coverage
  • [ ] Added necessary documentation
    • [ ] API documentation
    • [ ] Module documentation in Module.md files
    • [ ] Ballerina By Examples

gabilang avatar Oct 04 '22 10:10 gabilang

Codecov Report

Base: 79.24% // Head: 76.64% // Decreases project coverage by -2.60% :warning:

Coverage data is based on head (a45c915) compared to base (3fa663b). Patch coverage: 93.75% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #38057      +/-   ##
============================================
- Coverage     79.24%   76.64%   -2.61%     
+ Complexity    72657    53050   -19607     
============================================
  Files          3370     3354      -16     
  Lines        257898   199171   -58727     
  Branches      45862    25839   -20023     
============================================
- Hits         204376   152648   -51728     
+ Misses        44504    37851    -6653     
+ Partials       9018     8672     -346     
Impacted Files Coverage Δ
...allerina/runtime/internal/values/DecimalValue.java 61.53% <92.30%> (+1.97%) :arrow_up:
...lerina/runtime/api/constants/RuntimeConstants.java 94.73% <100.00%> (-1.82%) :arrow_down:
...untime/internal/util/exceptions/RuntimeErrors.java 99.09% <100.00%> (+1.61%) :arrow_up:
...a/compiler/api/impl/BallerinaKeywordsProvider.java 0.00% <0.00%> (-66.67%) :arrow_down:
.../compiler/diagnostic/CompilerBadSadDiagnostic.java 0.00% <0.00%> (-62.50%) :arrow_down:
...tensions/ballerina/document/visitor/FindNodes.java 0.00% <0.00%> (-61.12%) :arrow_down:
...rinalang/langserver/hover/HoverObjectResolver.java 27.93% <0.00%> (-60.68%) :arrow_down:
...llerinalang/debugadapter/variable/types/BByte.java 0.00% <0.00%> (-55.56%) :arrow_down:
...testerina/natives/mock/GenericMockObjectValue.java 8.75% <0.00%> (-51.25%) :arrow_down:
...alang/compiler/tree/types/BLangFiniteTypeNode.java 45.83% <0.00%> (-50.01%) :arrow_down:
... and 965 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Oct 05 '22 06:10 codecov[bot]

@gabilang, does this PR cover underflows?

KavinduZoysa avatar Oct 06 '22 04:10 KavinduZoysa

@gabilang, does this PR cover underflows?

No, Created a separate issue to address the subnormal cases. https://github.com/ballerina-platform/ballerina-lang/issues/38082

gabilang avatar Oct 06 '22 05:10 gabilang

Shall we add a test https://github.com/ballerina-platform/ballerina-lang/issues/33805#issuecomment-983276303

KavinduZoysa avatar Oct 06 '22 05:10 KavinduZoysa