From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21325 invoked by alias); 12 Jan 2012 17:27:19 -0000 Received: (qmail 21309 invoked by uid 22791); 12 Jan 2012 17:27:17 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_GC,T_HK_NAME_DR,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 12 Jan 2012 17:27:04 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q0CHR4Rg000494 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 12 Jan 2012 12:27:04 -0500 Received: from rivendell.middle-earth.co.uk (ovpn-113-73.phx2.redhat.com [10.3.113.73]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q0CHR0Gt025692 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Thu, 12 Jan 2012 12:27:03 -0500 Date: Thu, 12 Jan 2012 17:27:00 -0000 From: Dr Andrew John Hughes To: mauve-patches@sources.redhat.com Subject: FYI: SanityCheck for DateFormatSymbols Message-ID: <20120112172700.GA6667@rivendell.middle-earth.co.uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="CdrF4e02JqNVZeln" Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact mauve-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: mauve-patches-owner@sourceware.org X-SW-Source: 2012/txt/msg00000.txt.bz2 --CdrF4e02JqNVZeln Content-Type: multipart/mixed; boundary="M9NhX3UHpAaciwkO" Content-Disposition: inline --M9NhX3UHpAaciwkO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1595 I've been looking into a number of issues with the DateFormatSymbols locale data; see https://bugzilla.redhat.com/show_bug.cgi?id=3D712013 As part of this, I'm adding a test to Mauve which checks each locale's symbols to make sure: 1. The array is the right size. 2. All elements are not null. 3. All elements are not empty, unless allowed (weekday[0] and month[12]). With gcj 4.6.2, we have 783 failures out of 29216 tests. With the patch I'm about to post to GNU Classpath applied, this reduces to 235 out of 30456 (the test increase is due to some arrays now being their correct larger size, such as de_AT mentioned in the bug). For reference, OpenJDK has 0 failures out of 14288 tests (they have much less locale data). I should be able to get our failure rate down further by fixing further bugs in the locale data. The generator is currently picking up the wrong incomplete set of month & week names for locales like be and cy. 2012-01-12 Andrew John Hughes * gnu/testlet/java/text/DateFormatSymbols/SanityCheck.java: Extend test to also check array content for null/empty values. (checkArray(TestHarness, Locale, String, String[], int)): Helper method for checking locale data. Runs harness checks to ensure the array is the right size and has all non-null non-empty values (except where empty values are allowed for weekday[0] and month[12]). --=20 Andrew :) Free Java Software Engineer Red Hat, Inc. (http://www.redhat.com) PGP Key: 248BDC07 (https://keys.indymedia.org/) Fingerprint =3D EC5A 1F5E C0AD 1D15 8F1F 8F91 3B96 A578 248B DC07 --M9NhX3UHpAaciwkO Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=diff Content-Transfer-Encoding: quoted-printable Content-length: 3288 Index: gnu/testlet/java/text/DateFormatSymbols/SanityCheck.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/mauve/mauve/gnu/testlet/java/text/DateFormatSymbols/SanityCh= eck.java,v retrieving revision 1.1 diff -u -u -r1.1 SanityCheck.java --- gnu/testlet/java/text/DateFormatSymbols/SanityCheck.java 5 Jan 2012 14:= 36:31 -0000 1.1 +++ gnu/testlet/java/text/DateFormatSymbols/SanityCheck.java 12 Jan 2012 17= :15:28 -0000 @@ -25,6 +25,8 @@ import gnu.testlet.Testlet; =20 import java.text.DateFormatSymbols; +import java.util.Arrays; +import java.util.Calendar; import java.util.Locale; =20 /** @@ -46,12 +48,40 @@ for (int a =3D 0; a < locales.length; ++a) { DateFormatSymbols dfs =3D DateFormatSymbols.getInstance(locales[a]= ); - harness.check(dfs.getAmPmStrings().length =3D=3D 2, "AM/PM check (= " + locales[a] + ")"); - harness.check(dfs.getEras().length =3D=3D 2, "Eras check (" + loca= les[a] + ")"); - harness.check(dfs.getMonths().length =3D=3D 13, "Months check (" += locales[a] + ")"); - harness.check(dfs.getShortMonths().length =3D=3D 13, "Short months= check (" + locales[a] + ")"); - harness.check(dfs.getShortWeekdays().length =3D=3D 8, "Short weekd= ays check (" + locales[a] + ")"); - harness.check(dfs.getWeekdays().length =3D=3D 8, "Weekdays check (= " + locales[a] + ")"); + checkArray(harness, locales[a], "AM/PM", dfs.getAmPmStrings(), 2); + checkArray(harness, locales[a], "Eras", dfs.getEras(), 2); + checkArray(harness, locales[a], "Months", dfs.getMonths(), 13); + checkArray(harness, locales[a], "Short months", dfs.getShortMonths= (), 13); + checkArray(harness, locales[a], "Weekdays", dfs.getWeekdays(), 8); + checkArray(harness, locales[a], "Short weekdays", dfs.getShortWeek= days(), 8); + } + } + + /** + * Checks an array of locale data is of the correct size. + * + * @param harness the test harness. + * @param locale the locale being tested (for display purposes). + * @param type the type of data (for display purposes). + * @param array the array of strings. + * @param size the expected size of the array. + */ + private void checkArray(TestHarness harness, Locale locale, String type, + String[] array, int size) + { + harness.check(array.length =3D=3D size, type + "check (" + locale + ")= "); + harness.debug(locale + ": " + type + "=3D" + Arrays.toString(array)); + // Check entries are non-null and also non-empty (unless allowed). + for (int a =3D 0; a < array.length; ++a) + { + harness.check(array[a] !=3D null, type + "[" + a + "] null check (= " + + locale + ")"); + // Weekdays are indexed 1 to 7 not 0 to 6. The 13th month is not + // used by the Gregorian calendar. + if (!(type.contains("onths") && a =3D=3D Calendar.UNDECIMBER) && + !(type.contains("days") && a =3D=3D 0)) + harness.check(!array[a].isEmpty(), type + "[" + a + "] empty che= ck (" + + locale + ")"); } } =20 --M9NhX3UHpAaciwkO-- --CdrF4e02JqNVZeln Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-length: 836 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (GNU/Linux) iQIcBAEBCgAGBQJPDxfkAAoJEDuWpXgki9wH7VoP/2Xx7+TrrmXzfd4+1Gxzbttr esyQdzv/ssxj7MgpjvM8CEyrWk7HS+GH39V4+xgA72dV5Lv4kAsp2uXOxAAP71jT x1amXa3KGVU5bW7IODOxZNSX77u+HLwTJKhwwc0RLhbVTcSvNqRyHiyIiKpNLaef 9CZ/kSnMMzgc85eoh+cirJ1j42AOK9ro/QsKd27A/vgsM7d14GP0BC7/II2JZrwb axWEpGE6zeLFI+KRNwzuKiVMbXrsvNVYY1vuHV8w8wptINkugf9VOfNFR1BlE6op 24flJDoQa/IlgMON7OgofmxD2aLiI9iVjuvXZk0l4aXqfi6ibfjurpbW6LW96fUW oaLlFVaI8goYxpDaITm8iqOSXCP4XOuning8e/mL7vJpKNIzj6vT9rLBmlNopQr/ 9w2gD13dDXAQQt2r1uMcTxfPkZWG8ZpzSj2BQowL9i7Di09rSjtS7qnTW7H+n1KK OK4bRRb4titkSrNj5c7zFZOFG0slF8/ZNDiFBX4/eUDl9zAKkH9KOAr/QbzBfgn4 jd2CUB44L1OYIBXNPd/6dbE2c9SZcWj9p6OjPEF71iFF3ruhmtBZqqY2LRKsvP+A Eb4vs8OR7CIjtzGkyxyZmvyKHpXQ9fm1QTf0NlAPtyNMIrc+YRmLr96GK4nod0Sd Q5uNrYGNWGKD2rgBoUoC =A/bn -----END PGP SIGNATURE----- --CdrF4e02JqNVZeln--