Skip to content

[MINOR] Add ToString test for decimal-formatting in toString builtin#2503

Merged
Baunsgaard merged 5 commits into
apache:mainfrom
Baunsgaard:split/toString
Jun 24, 2026
Merged

[MINOR] Add ToString test for decimal-formatting in toString builtin#2503
Baunsgaard merged 5 commits into
apache:mainfrom
Baunsgaard:split/toString

Conversation

@Baunsgaard

Copy link
Copy Markdown
Contributor

Adds five new test cases that exercise toString(X, rows=, cols=, decimal=) with values that hit common formatting edge cases: integer-valued scalars, mid-range decimals, requested decimals beyond the value's precision, rounding at the last requested digit, and small near-zero values.

Adds five new test cases that exercise toString(X, rows=, cols=,
decimal=) with values that hit common formatting edge cases:
integer-valued scalars, mid-range decimals, requested decimals
beyond the value's precision, rounding at the last requested digit,
and small near-zero values.

- New DML script ToString12.dml driving toString with parameterized
  value and decimal-count
- New testPrintWithDecimal{1..5} cases and a toStringTestHelper2
  helper in ToStringTest
@github-project-automation github-project-automation Bot moved this to In Progress in SystemDS PR Queue Jun 23, 2026
@Baunsgaard Baunsgaard changed the title [MINOT] Add ToString test for decimal-formatting in toString builtin [MINOR] Add ToString test for decimal-formatting in toString builtin Jun 23, 2026
DecimalFormat defaults maximumFractionDigits to 3, and toString only
set the minimum, so decimal=2 on 5.244058 printed "5.244" (3 digits)
instead of "5.24". Set the maximum fraction digits alongside the
minimum in the matrix, tensor, and frame toString paths so decimal=N
produces exactly N decimals. This makes testPrintWithDecimal2 pass.
The matrix, tensor, and frame toString paths each built an identical
non-grouping DecimalFormat and pinned min/max fraction digits to the
requested decimal count. Consolidate that into a single private helper
so the exact-fraction-digit configuration lives in one place.
@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.54%. Comparing base (88c26e2) to head (f8473e0).
⚠️ Report is 22 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #2503      +/-   ##
============================================
+ Coverage     71.37%   71.54%   +0.16%     
- Complexity    48749    48959     +210     
============================================
  Files          1571     1573       +2     
  Lines        188912   189331     +419     
  Branches      37067    37147      +80     
============================================
+ Hits         134845   135461     +616     
+ Misses        43601    43388     -213     
- Partials      10466    10482      +16     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

The decimal-formatting path was only exercised for matrices. Add
direct frame and tensor toString tests that print FP64 values needing
clamping (decimal=2 on 5.244058 -> 5.24), padding (22 -> 22.0000) and
rounding (-> 5.2441), covering the frame and tensor formatting paths
and guarding the exact-fraction-digit behavior.
Cover the decimal < 0 path in DataConverter.createDecimalFormat, where
DecimalFormat is left unconstrained (no min/max fraction digits). The new
frame and tensor cases assert integer values are unpadded and fractional
values keep the default three-digit cap, closing the partial-coverage
branch in the shared helper.
@Baunsgaard Baunsgaard merged commit b20b5b9 into apache:main Jun 24, 2026
50 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in SystemDS PR Queue Jun 24, 2026
@Baunsgaard Baunsgaard deleted the split/toString branch June 24, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant