allow to round values in CSVexporter - #5497
Conversation
25a9222 to
92ba4b8
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
Tick the box to add this pull request to the merge queue (same as
|
There was a problem hiding this comment.
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
decimalPlacesCountconstructor parameter toCSVExporterand 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
intervalanddecimalPlacesCounttoCSVExporter.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| alchemist-loading/src/main/kotlin/it/unibo/alchemist/boundary/exporters/CSVExporter.kt | Adds exporter-level decimal rounding support via a new parameter and a rounding helper. |
| alchemist-loading/src/test/kotlin/it/unibo/alchemist/test/TestCSVExporter.kt | Updates the regex used to validate decimal formatting in exported data. |
| alchemist-incarnation-protelis/src/test/resources/testbase.yml | Exercises the new exporter parameters in a test configuration. |
| 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) -> |
There was a problem hiding this comment.
@Nathekip, add a test with multiple columns, please, and if that it goes red, apply a fix!
Thank you, let me know
212bdd4 to
7b19587
Compare
ef40806 to
65ae803
Compare
9c11dc4 to
d9063af
Compare
|



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