Skip to content

Commit

Permalink
Pre-16 and NFKCQC
Browse files Browse the repository at this point in the history
  • Loading branch information
eggrobin committed Dec 1, 2023
1 parent cc76245 commit e23d1c1
Showing 1 changed file with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,23 @@ public void TestAAScripts() {
}

@Test
public void TestQuickCheckConsistency() {
public void TestNFCQuickCheckConsistency() {
UnicodeMap<String> nfcqc = iup.load(UcdProperty.NFC_Quick_Check);
UnicodeMap<String> dm = iup.load(UcdProperty.Decomposition_Mapping);
UnicodeMap<String> dt = iup.load(UcdProperty.Decomposition_Type);
UnicodeMap<String> age = iup.load(UcdProperty.Age);
for (String codepoint : nfcqc.getSet("Yes")) {
if (!dt.getValue(codepoint).equals("Canonical") || age.getValue(codepoint).equals("V16_0")) {
continue;
}
String decompositionFirst = Character.toString(dm.getValue(codepoint).codePointAt(0));
String decompositionFirstNFCQC = nfcqc.getValue(decompositionFirst);
assertEquals(
"Pre-16 U+" + getCodeAndName(codepoint) + "(Age=" + age.getValue(codepoint) + ") has NFC_QC=Yes, but its (canonical) Decomposition_Mapping starts with U+"
+ getCodeAndName(decompositionFirst) + ", which has NFC_QC=" + decompositionFirstNFCQC,
"Yes",
decompositionFirstNFCQC);
}
for (String codepoint : nfcqc.getSet("Yes")) {
if (!dt.getValue(codepoint).equals("Canonical")) {
continue;
Expand All @@ -233,6 +246,34 @@ public void TestQuickCheckConsistency() {
}
}

@Test
public void TestNFKCQuickCheckConsistency() {
UnicodeMap<String> nfkcqc = iup.load(UcdProperty.NFC_Quick_Check);
UnicodeMap<String> dm = iup.load(UcdProperty.Decomposition_Mapping);
UnicodeMap<String> age = iup.load(UcdProperty.Age);
for (String codepoint : nfkcqc.getSet("Yes")) {
if (age.getValue(codepoint).equals("V16_0")) {
continue;
}
String decompositionFirst = Character.toString(dm.getValue(codepoint).codePointAt(0));
String decompositionFirstNFKCQC = nfkcqc.getValue(decompositionFirst);
assertEquals(
"Pre-16 U+" + getCodeAndName(codepoint) + "(Age=" + age.getValue(codepoint) + ") has NFKC_QC=Yes, but its Decomposition_Mapping starts with U+"
+ getCodeAndName(decompositionFirst) + ", which has NFKC_QC=" + decompositionFirstNFKCQC,
"Yes",
decompositionFirstNFKCQC);
}
for (String codepoint : nfkcqc.getSet("Yes")) {
String decompositionFirst = Character.toString(dm.getValue(codepoint).codePointAt(0));
String decompositionFirstNFKCQC = nfkcqc.getValue(decompositionFirst);
assertEquals(
"U+" + getCodeAndName(codepoint) + " has NFKC_QC=Yes, but its Decomposition_Mapping starts with U+"
+ getCodeAndName(decompositionFirst) + ", which has NFKC_QC=" + decompositionFirstNFKCQC,
"Yes",
decompositionFirstNFKCQC);
}
}

@Test
public void TestJoiningGroupConsistency() {
// TODO(egg): I would like to be able to put that in the invariants tests as « the partition
Expand Down

0 comments on commit e23d1c1

Please sign in to comment.