[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/_test/tests/inc/ -> sort_with_collator.test.php (summary)

(no description)

File Size: 356 lines (12 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

sort_with_collator_test:: (10 methods):
  testIntlExtensionAvailability()
  provideWordPairs()
  provideSortedCharList()
  testStrcmp()
  testSort()
  testKSort()
  testASort()
  testASortFnUrl()
  testASortFnSafe()
  testASortFnUtf8()


Class: sort_with_collator_test  - X-Ref


testIntlExtensionAvailability()   X-Ref
No description

provideWordPairs()   X-Ref
Provide real word pairs of the languages being tested (when possible).
Everything which is beyond the usual A-Z order should be checked,
including every character with an accent (diacritic) used in the language.

CHECKING NON-EQUIVALENT CHARACTERS (X < Y)

In this case, the words are always sorted according to the character pair.
Craft word pairs to double-check the collator, such that sort by the next
character yields the opposite result.

Esperanto example: ĉ < d
ĉokolado, dento ==> ĉ < d ==> ĉokolado < dento
(if ĉ < d would fail, o < e would also fail ==> collator failure)

CHECKING EQUIVALENT CHARACTERS (X = Y)

If the sole difference between the words is the character pair, the sort
will be as if X < Y. Otherwise the characters will be treated as the same.
Craft two word pairs to test both conditions.

German example: a = ä
Sole diff.: Apfel, Äpfel ==> a < ä        ==> Apfel < Äpfel
Otherwise:  Ämter, Arzt  ==> a = ä, m < r ==> Ämter < Arzt

CHECKING MULTIPLE EQUIVALENT CHARACTERS (X = Y = Z = ...)

An extension of the above case. If the sole difference between the words is
a character pair from the given set, the sort will be as if X < Y < Z < ...
Otherwise the characters will be treated as the same.
Craft at least one word pair to test the first case and as many as possible
to test the other case.

Portuguese example: e = é = ê
Sole diff.: de, dê         ==> e < ê                  ==> de < dê
Otherwise:  pé, pedra      ==> é = e, end of word < d ==> pé < pedra
pêssego, peste ==> ê = e, s = s, s < t    ==> pêssego < peste

see: testStrcmp
return: Generator|array

provideSortedCharList()   X-Ref
Provide the sorted sequences of all characters used in the languages being tested.
Everything which is beyond the usual A-Z order should be checked.

CHECKING NON-EQUIVALENT CHARACTERS (X < Y)

Add a 2nd character to double-check the collator, such that sort by the 2nd
character yields the opposite result.

Esperanto example: ĉ < d
2nd character: ĉe, da ==> ĉ < d ==> ĉe < da
(if ĉ < d would fail, e < a would also fail ==> collator failure)

CHECKING EQUIVALENT CHARACTERS (X = Y = Z)

Don't add a 2nd character, because it would break the test. The lone characters
will be sorted as words with a sole difference, that is, as if X < Y < Z.

German example: a = ä
Sole difference: a, ä ==> a < ä

see: testSort
see: testKSort
see: testASort
see: testASortFnUrl
see: testASortFnSafe
see: testASortFnUtf8
return: Generator|array

testStrcmp($lang, $word1, $word2)   X-Ref

param: string $lang
param: string $word1
param: string $word2

testSort($lang, $list)   X-Ref

param: string $lang
param: string $list

testKSort($lang, $list)   X-Ref

param: string $lang
param: string $list

testASort($lang, $list)   X-Ref

param: string $lang
param: string $list

testASortFnUrl($lang, $list)   X-Ref

param: string $lang
param: string $list

testASortFnSafe($lang, $list)   X-Ref

param: string $lang
param: string $list

testASortFnUtf8($lang, $list)   X-Ref

param: string $lang
param: string $list