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

ICU-22781 Uncomment and enable constant denominator tests #3385

Merged
merged 1 commit into from
Feb 14, 2025

Conversation

younies
Copy link
Member

@younies younies commented Feb 10, 2025

Description:

Re-enable previously commented out tests for constant denominators in units tests for both ICU4C and ICU4J. This includes tests for:

  • Large power of 10 denominators
  • Scientific notation denominators
  • Specific unit denominators

Added notes about potential CLDR-related edge cases for certain unit representations.

Checklist

  • Required: Issue filed: ICU-22781
  • Required: The PR title must be prefixed with a JIRA Issue number. Example: "ICU-1234 Fix xyz"
  • Required: Each commit message must be prefixed with a JIRA Issue number. Example: "ICU-1234 Fix xyz"
  • Issue accepted (done by Technical Committee after discussion)
  • Tests included, if applicable
  • API docs and/or User Guide docs changed or added, if applicable

Copy link
Contributor

@richgillam richgillam left a comment

Choose a reason for hiding this comment

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

Where's the part where you actually test that formatting does he right thing with this unit?

// `portion-per-1e9` is treated as a unit in CLDR,
// the unit does not have a constant denominator.
// This issue should be addressed in CLDR & ICU.
{"portion-per-1000000000", 0},
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there an outstanding ticket for this? If so, you should probably include the ticket number (or a link) here.

Copy link
Member

Choose a reason for hiding this comment

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

portion-per-1e9 is treated as a precomputed form for translation, not a single unit.

Some units already have 'precomputed' forms, such as kilometer-per-hour; where such units exist, they should be used in preference.

We shouldn't test for the wrong behavior.
That being said, given the schedule, and the fact that we are going fix the problem fully in 48, it's ok for {"portion-per-1000000000", 1000000000}, be present but commented out.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, I have added it back with logKnownIssue so it can be addressed in the next release.

// `portion-per-1e9` is treated as a unit in CLDR,
// the unit does not have a constant denominator.
// This issue should be addressed in CLDR & ICU.
{"portion-per-1000000000", 0},
Copy link
Member

Choose a reason for hiding this comment

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

portion-per-1e9 is treated as a precomputed form for translation, not a single unit.

Some units already have 'precomputed' forms, such as kilometer-per-hour; where such units exist, they should be used in preference.

We shouldn't test for the wrong behavior.
That being said, given the schedule, and the fact that we are going fix the problem fully in 48, it's ok for {"portion-per-1000000000", 1000000000}, be present but commented out.

// This issue should be addressed in CLDR & ICU.
new ConstantDenominatorTestCase("portion-per-1000000000", 0),
new ConstantDenominatorTestCase("portion-per-1e9", 0),
new ConstantDenominatorTestCase("portion-per-1E9", 0),
Copy link
Member

Choose a reason for hiding this comment

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

Same here.

Copy link
Member Author

Choose a reason for hiding this comment

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

done, I added also a logKnownIssue

@@ -1205,6 +1205,7 @@ void UnitsTest::testUnitsConstantsDenomenator() {
{"portion-per-7", 7},
{"portion-per-8", 8},
{"portion-per-9", 9},
Copy link
Contributor

Choose a reason for hiding this comment

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

These cases don't exist in the Java tests.
Is there a good reason to have them?
Are they testing something interesting, that is not well covered by other cases?
They they should also be in Java.

If they don't actually exercise anything interesting, we should not have them in C/C++ either.

In general the tests in C++ and Java should be the same, unless there are very good reasons (for example Java testing for all kind of types that don't exist in C++)

Copy link
Member Author

Choose a reason for hiding this comment

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

now , c++ and java are identical, sorry for this small confusion.

@younies
Copy link
Member Author

younies commented Feb 11, 2025

Where's the part where you actually test that formatting does he right thing with this unit?

@richgillam : for testing the formatting:
#3389
#3390

younies added a commit to younies/icu that referenced this pull request Feb 11, 2025
@younies younies force-pushed the enable-constant-tests branch from c18f728 to 573f7e8 Compare February 11, 2025 18:52
@jira-pull-request-webhook
Copy link

Hooray! The files in the branch are the same across the force-push. 😃

~ Your Friendly Jira-GitHub PR Checker Bot

@richgillam
Copy link
Contributor

Where's the part where you actually test that formatting does he right thing with this unit?

@richgillam : for testing the formatting: #3389 #3390

Thank you.

Copy link
Contributor

@richgillam richgillam left a comment

Choose a reason for hiding this comment

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

Looks okay to me, but I think you should get approval from somebody who raised objections the last time around.

{"portion-per-1000000000000000", 1000000000000000},
{"portion-per-10000000000000000", 10000000000000000},
{"portion-per-100000000000000000", 100000000000000000},
{"portion-per-1000000000000000000", 1000000000000000000},
Copy link
Contributor

Choose a reason for hiding this comment

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

Same issue as in the other PRs: If these are all expected to fail and are being covered by logKnownIssue() in the code, put some sort of comment next to the actual test case to indicate that (the ticket number you had in the earlier version of these changes works, for example). Same thing further down in here.

An alternative approach would be to add a knownIssueTicketNumber property to your TestCase object-- the test code would look for that and, if it's populated, skip the test and pass it to logKnownIssue.

Copy link
Member Author

Choose a reason for hiding this comment

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

done now :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Is line 1219 the only one that's failing? If so, we're good here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it is the only one that is failing.

@younies younies force-pushed the enable-constant-tests branch from 573f7e8 to 771dad2 Compare February 12, 2025 10:08
@jira-pull-request-webhook
Copy link

Notice: the branch changed across the force-push!

  • icu4c/source/test/intltest/measfmttest.cpp is different
  • icu4c/source/test/intltest/units_test.cpp is different
  • icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/format/MeasureUnitTest.java is different

View Diff Across Force-Push

~ Your Friendly Jira-GitHub PR Checker Bot

@younies
Copy link
Member Author

younies commented Feb 14, 2025

@macchiati , can you take a look ?

@younies younies merged commit 3c85be1 into unicode-org:main Feb 14, 2025
101 checks passed
@younies younies deleted the enable-constant-tests branch February 14, 2025 09:35
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.

4 participants