From 02fd7496d41ce00ac8241888136a7bf20f7d7d50 Mon Sep 17 00:00:00 2001 From: Robin Leroy Date: Sat, 15 Apr 2023 05:08:32 +0200 Subject: [PATCH 1/3] A test --- .../org/unicode/propstest/TestProperties.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/unicodetools/src/test/java/org/unicode/propstest/TestProperties.java b/unicodetools/src/test/java/org/unicode/propstest/TestProperties.java index 1d5c37b06..409319eb5 100644 --- a/unicodetools/src/test/java/org/unicode/propstest/TestProperties.java +++ b/unicodetools/src/test/java/org/unicode/propstest/TestProperties.java @@ -212,6 +212,33 @@ public void TestAAScripts() { } } + @Test + public void TestJoiningGroupConsistency() { + // TODO(egg): I would like to be able to put that in the invariants tests as « the partition + // defined by Joining_Group is finer than that defined by Joining_Type ». + UnicodeMap joiningGroup = iup.load(UcdProperty.Joining_Group); + UnicodeMap joiningType = iup.load(UcdProperty.Joining_Type); + var charactersByJoiningGroup = new HashMap(); + joiningGroup.addInverseTo(charactersByJoiningGroup).remove("No_Joining_Group"); + charactersByJoiningGroup.forEach( + (group, set) -> { + final int first = set.getRangeStart(0); + final String firstType = joiningType.get(first); + set.forEach( + (c) -> { + assertEquals( + Utility.hex(c) + + " and " + + Utility.hex(first) + + " have different joining types but are in the" + + " same joining group " + + group, + joiningType.get(c), + firstType); + }); + }); + } + @Test public void TestScripts() { From 1b0a15e77827093d288f44a8a5cfd9e662ba7cce Mon Sep 17 00:00:00 2001 From: Robin Leroy Date: Sat, 15 Apr 2023 05:14:41 +0200 Subject: [PATCH 2/3] flip --- .../test/java/org/unicode/propstest/TestProperties.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/unicodetools/src/test/java/org/unicode/propstest/TestProperties.java b/unicodetools/src/test/java/org/unicode/propstest/TestProperties.java index 409319eb5..11e815091 100644 --- a/unicodetools/src/test/java/org/unicode/propstest/TestProperties.java +++ b/unicodetools/src/test/java/org/unicode/propstest/TestProperties.java @@ -227,14 +227,14 @@ public void TestJoiningGroupConsistency() { set.forEach( (c) -> { assertEquals( - Utility.hex(c) + Utility.hex(first) + " and " - + Utility.hex(first) + + Utility.hex(c) + " have different joining types but are in the" + " same joining group " + group, - joiningType.get(c), - firstType); + firstType, + joiningType.get(c)); }); }); } From 7fa9f0ecfb18fb77789cb6fed4fc9ed607aaf425 Mon Sep 17 00:00:00 2001 From: Robin Leroy Date: Sat, 15 Apr 2023 05:21:50 +0200 Subject: [PATCH 3/3] fancier --- .../java/org/unicode/propstest/TestProperties.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/unicodetools/src/test/java/org/unicode/propstest/TestProperties.java b/unicodetools/src/test/java/org/unicode/propstest/TestProperties.java index 11e815091..b9386f5fc 100644 --- a/unicodetools/src/test/java/org/unicode/propstest/TestProperties.java +++ b/unicodetools/src/test/java/org/unicode/propstest/TestProperties.java @@ -227,12 +227,14 @@ public void TestJoiningGroupConsistency() { set.forEach( (c) -> { assertEquals( - Utility.hex(first) - + " and " - + Utility.hex(c) - + " have different joining types but are in the" - + " same joining group " - + group, + "U+" + + getCodeAndName(Character.toString(first)) + + "\nand\nU+" + + getCodeAndName(c) + + "\nhave different joining types but are in the" + + " same joining group (" + + group + + ")\n", firstType, joiningType.get(c)); });