From b39b13957e5d6bf46999fc1c03a2593351544656 Mon Sep 17 00:00:00 2001 From: Robin Leroy Date: Tue, 2 May 2023 11:55:56 +0200 Subject: [PATCH] Test that Joining_Group refines Joining_Type (#439) --- .../org/unicode/propstest/TestProperties.java | 29 +++++++++++++++++++ 1 file changed, 29 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..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() {