Subject UtfNormal::cleanUp() to the same tests as UtfNormal::toNFC()
This commit is contained in:
parent
17af3bff2e
commit
5cf94de93f
1 changed files with 17 additions and 0 deletions
|
|
@ -157,6 +157,7 @@ function testNormals( &$u, $c, $comment, $reportFailure = false ) {
|
|||
$result = testNFD( $u, $c, $comment, $reportFailure ) && $result;
|
||||
$result = testNFKC( $u, $c, $comment, $reportFailure ) && $result;
|
||||
$result = testNFKD( $u, $c, $comment, $reportFailure ) && $result;
|
||||
$result = testCleanUp( $u, $c, $comment, $reportFailure ) && $result;
|
||||
|
||||
global $verbose;
|
||||
if( $verbose && !$result && !$reportFailure ) {
|
||||
|
|
@ -188,6 +189,20 @@ function testNFC( &$u, $c, $comment, $verbose ) {
|
|||
return $result;
|
||||
}
|
||||
|
||||
function testCleanUp( &$u, $c, $comment, $verbose ) {
|
||||
$x = $c[1];
|
||||
$result = verbosify( $c[2], $u->cleanUp( $x ), 1, 'cleanUp', $verbose );
|
||||
$x = $c[2];
|
||||
$result = verbosify( $c[2], $u->cleanUp( $x ), 2, 'cleanUp', $verbose ) && $result;
|
||||
$x = $c[3];
|
||||
$result = verbosify( $c[2], $u->cleanUp( $x ), 3, 'cleanUp', $verbose ) && $result;
|
||||
$x = $c[4];
|
||||
$result = verbosify( $c[4], $u->cleanUp( $x ), 4, 'cleanUp', $verbose ) && $result;
|
||||
$x = $c[5];
|
||||
$result = verbosify( $c[4], $u->cleanUp( $x ), 5, 'cleanUp', $verbose ) && $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
function testNFD( &$u, $c, $comment, $verbose ) {
|
||||
$result = verbosify( $c[3], $u->toNFD( $c[1] ), 1, 'NFD', $verbose );
|
||||
$result = verbosify( $c[3], $u->toNFD( $c[2] ), 2, 'NFD', $verbose ) && $result;
|
||||
|
|
@ -220,6 +235,8 @@ function testInvariant( &$u, $char, $desc, $reportFailure = false ) {
|
|||
$result = verbosify( $char, $u->toNFD( $char ), 1, 'NFD', $reportFailure ) && $result;
|
||||
$result = verbosify( $char, $u->toNFKC( $char ), 1, 'NFKC', $reportFailure ) && $result;
|
||||
$result = verbosify( $char, $u->toNFKD( $char ), 1, 'NFKD', $reportFailure ) && $result;
|
||||
$c = $char;
|
||||
$result = verbosify( $char, $u->cleanUp( $char ), 1, 'cleanUp', $reportFailure ) && $result;
|
||||
global $verbose;
|
||||
if( $verbose && !$result && !$reportFailure ) {
|
||||
print $desc;
|
||||
|
|
|
|||
Loading…
Reference in a new issue