Skip to content

Commit

Permalink
Test that Joining_Group refines Joining_Type (#439)
Browse files Browse the repository at this point in the history
  • Loading branch information
eggrobin authored May 2, 2023
1 parent 6230617 commit b39b139
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> joiningGroup = iup.load(UcdProperty.Joining_Group);
UnicodeMap<String> joiningType = iup.load(UcdProperty.Joining_Type);
var charactersByJoiningGroup = new HashMap<String, UnicodeSet>();
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() {

Expand Down

0 comments on commit b39b139

Please sign in to comment.