Skip to content

Commit

Permalink
CLDR-11155 Pages too big: revise test for large pages (#3573)
Browse files Browse the repository at this point in the history
  • Loading branch information
btangmu authored Apr 3, 2024
1 parent 827d458 commit de809a5
Showing 1 changed file with 15 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1684,14 +1684,14 @@ public void testPageSize() {
final long minError = 946; // above this, emit error
final long minLog = 700; // otherwise above this, emit warning
Factory factory = CLDRConfig.getInstance().getCommonAndSeedAndMainAndAnnotationsFactory();
// "en", "cs", "ar", "pl"
List<String> locales =
StandardCodes.make()
.getLocaleCoverageLocales(Organization.cldr, ImmutableSet.of(Level.MODERN))
.stream()
.filter(x -> CLDRLocale.getInstance(x).getCountry().isEmpty())
.collect(Collectors.toUnmodifiableList());
List<Counter<PageId>> counters = new ArrayList<>();
final String thresholdExplanation = "log/error thresholds are " + minLog + "/" + minError;
for (String locale : locales) {
CLDRFile cldrFile = factory.make(locale, false);
PathHeader.Factory phf = PathHeader.getFactory();
Expand All @@ -1703,23 +1703,20 @@ public void testPageSize() {
}
for (PageId entry : c.getKeysetSortedByKey()) {
long count = c.getCount(entry);
if (count > minError) {
errln(
locale
+ "\t"
+ entry.getSectionId()
+ "\t"
+ entry
+ "\thas too many entries:\t"
+ count);
} else if (count > minLog) {
warnln(
locale
+ "\t"
+ entry.getSectionId()
+ "\t"
+ "\thas too many entries:\t"
+ count);
if (count > minLog) {
final String message =
String.format(
"%s\t%s\t%s\thas too many entries:\t%d\t(%s)",
locale,
entry.getSectionId().toString(),
entry,
count,
thresholdExplanation);
if (count > minError) {
errln(message);
} else {
warnln(message);
}
}
}
}
Expand Down

0 comments on commit de809a5

Please sign in to comment.