From: Brion Vibber Date: Sat, 30 Oct 2004 05:24:24 +0000 (+0000) Subject: Subject UtfNormal::cleanUp() to the same tests as UtfNormal::toNFC() X-Git-Tag: 1.5.0alpha1~1426 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=5cf94de93f8ddc65c565002189f52eeca8fa9e56;p=lhc%2Fweb%2Fwiklou.git Subject UtfNormal::cleanUp() to the same tests as UtfNormal::toNFC() --- diff --git a/includes/normal/UtfNormalTest.php b/includes/normal/UtfNormalTest.php index 108bf5c6ac..6aea3a40d5 100644 --- a/includes/normal/UtfNormalTest.php +++ b/includes/normal/UtfNormalTest.php @@ -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;