Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/nw23001440/editc problems #409

Merged
merged 15 commits into from
Feb 2, 2024

Conversation

cosentino-smeup
Copy link
Collaborator

Description

With this branch we have fixed all the problems occurring when formatting decimal values to string.

Most relevant changes:

  • spotted the operation to do for any edit code
  • properly managed every edit code
  • fixed all problems, errors and all wrong tests based on the old version
  • added some unsupported edit code cases: negative number with X edit code, out of limit of number with Y edit code (<=2, >9)
  • refactored the structure of code in the source "formatting.kt"

Related to:
T15_A50

Checklist:

  • There are tests regarding this feature
  • The code follows the Kotlin conventions (run ./gradlew ktlintCheck)
  • The code passes all tests (run ./gradlew check)
  • There is a specific documentation in the docs directory

Copy link
Collaborator

@lanarimarco lanarimarco left a comment

Choose a reason for hiding this comment

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

I like it, but I have some doubts.

First: I have seen that you have commented in some mute test, the assertion related the edicode X, I remember something but my memories are a little bit confused...

Second: The editcode is a really messy operation code, in my opinion, when we work with this level of complexity we should create some unit tests in order to test the related logic, also before to test this logic through the rpgle program interpretation.
In this case I whould have written a test suite named FormattingTest and create for each editcode a test unit decimalFormatF1(), decimalFormatFn(), for each function defined in DecimalValue.formatAs extension function.
What do you think about this?

@cosentino-smeup
Copy link
Collaborator Author

  1. The edit code X, in case of negative numbers, transforms the last digit in a letter with the following translation:

0 }
1 J
2 K
3 L
4 M
5 N
6 O
7 P
8 Q
9 R

If the last digit of the negative number is "0" will be replaced with "}"
If the last digit of the negative number is "1" will be replaced with "J"
and so on ..

The meaning of this translation to make the string 1 character shorter. We must go back many years behind this decision where saving a byte use to make the difference.

The problem was that the character "}" could work only with Italian settings.

To avoid other unknown side effects, has been decided not to support negative numbers with the X edit code.

  1. Regarding unit tests, I am not sure what benefits they could bring, which integration tests do not already provide. Another point, because I don't know the entire development infrastructure yet, is when they would run. I know for example that IT run after a commit in a branch. What about the unit tests?

@lanarimarco
Copy link
Collaborator

lanarimarco commented Feb 2, 2024 via email

Copy link
Collaborator

@lanarimarco lanarimarco left a comment

Choose a reason for hiding this comment

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

Ok, I will merge it as soon as the previous pr will be approved.

@lanarimarco lanarimarco marked this pull request as ready for review February 2, 2024 09:49
@lanarimarco lanarimarco merged commit 7ed9142 into develop Feb 2, 2024
3 checks passed
@lanarimarco lanarimarco deleted the bugfix/NW23001440/EDITC_problems branch February 27, 2024 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants