diff --git a/unicodetools/src/test/java/org/unicode/propstest/TestProperties.java b/unicodetools/src/test/java/org/unicode/propstest/TestProperties.java index 1d5c37b06..b9386f5fc 100644 --- a/unicodetools/src/test/java/org/unicode/propstest/TestProperties.java +++ b/unicodetools/src/test/java/org/unicode/propstest/TestProperties.java @@ -212,6 +212,35 @@ 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( + "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)); + }); + }); + } + @Test public void TestScripts() {