From 4bc06798dfd1e2b8866643f2f6e598819ae943ae Mon Sep 17 00:00:00 2001 From: btangmu Date: Wed, 20 Mar 2024 12:10:34 -0400 Subject: [PATCH] CLDR-11155 Pages too big: revise test for large pages -In testPageSize in TestPathHeader.java, show not only Section but also Page -Also show log/error thresholds, and use String.format, per suggestions in PR 3519 --- .../unicode/cldr/unittest/TestPathHeader.java | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPathHeader.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPathHeader.java index b1d627e9084..e2f4ee43106 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPathHeader.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestPathHeader.java @@ -1684,7 +1684,6 @@ 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 locales = StandardCodes.make() .getLocaleCoverageLocales(Organization.cldr, ImmutableSet.of(Level.MODERN)) @@ -1692,6 +1691,7 @@ public void testPageSize() { .filter(x -> CLDRLocale.getInstance(x).getCountry().isEmpty()) .collect(Collectors.toUnmodifiableList()); List> 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(); @@ -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); + } } } }