Skip to content

allow to round values in CSVexporter - #5497

Open
Nathekip wants to merge 3 commits into
AlchemistSimulator:masterfrom
Nathekip:master
Open

allow to round values in CSVexporter#5497
Nathekip wants to merge 3 commits into
AlchemistSimulator:masterfrom
Nathekip:master

Conversation

@Nathekip

Copy link
Copy Markdown

This PR partially tackles the issue #131, specifically the ability for user to specify the amount of numbers they want after the decimal

@Nathekip
Nathekipforce-pushed the master branch 3 times, most recently from 25a9222 to 92ba4b8CompareJuly 21, 2026 10:46
@codecov

codecovBot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.53%. Comparing base (e71f923) to head (c5abd87).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@ Coverage Diff @@## master #5497 +/- ##
=========================================
Coverage 61.53% 61.53% Complexity 14 14 =========================================
Files 2 2 Lines 78 78 Branches 4 4 =========================================
Hits 48 48 Misses 24 24 Partials 6 6 

☔ 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.

@mergify

mergifyBot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR begins implementing issue #131’s request to let users control numeric rounding in CSV exports by introducing a new decimalPlacesCount parameter on CSVExporter and adjusting tests/configuration accordingly.

Changes:

  • Added a decimalPlacesCount constructor parameter to CSVExporter and used it to round exported values in one output branch.
  • Updated TestCSVExporter’s numeric-matching regex for the “fixed decimals” export.
  • Updated a Protelis test YAML to pass interval and decimalPlacesCount to CSVExporter.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

FileDescription
alchemist-loading/src/main/kotlin/it/unibo/alchemist/boundary/exporters/CSVExporter.ktAdds exporter-level decimal rounding support via a new parameter and a rounding helper.
alchemist-loading/src/test/kotlin/it/unibo/alchemist/test/TestCSVExporter.ktUpdates the regex used to validate decimal formatting in exported data.
alchemist-incarnation-protelis/src/test/resources/testbase.ymlExercises the new exporter parameters in a test configuration.

Comment on lines 104 to 108
when {
data.size <= 1 -> data.values.joinToString(" ")
data.size <= 1 ->
roundValues(data.values, decimalPlacesCount.toInt()).joinToString(" ")
// Labels and keys match
data.size == names.size && data.keys.containsAll(names) ->

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Nathekip, add a test with multiple columns, please, and if that it goes red, apply a fix!
Thank you, let me know

@DanySK
DanySKforce-pushed the master branch 20 times, most recently from 212bdd4 to 7b19587CompareJuly 27, 2026 19:52
@DanySK
DanySKforce-pushed the master branch 18 times, most recently from ef40806 to 65ae803CompareAugust 8, 2026 22:34
@DanySK
DanySKforce-pushed the master branch 7 times, most recently from 9c11dc4 to d9063afCompareAugust 12, 2026 10:46
@sonarqubecloud

Copy link
Copy Markdown

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@Nathekip@DanySK