ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
RandomTest.php File Reference

Go to the source code of this file.

Functions

 randomString ($length, $nullOk, $ascii=false)
 donorm ($str)
 wfMsg ($x)
 showDiffs ($a, $b)

Variables

 if (php_sapi_name()!= 'cli')
 $size = 16
 $n = 0

Function Documentation

donorm (   $str)

Definition at line 49 of file RandomTest.php.

References UNORM_NFC, UTF8_FFFE, UTF8_FFFF, and UTF8_REPLACEMENT.

{
# We exclude a few chars that ICU would not.
$str = preg_replace( '/[\x00-\x08\x0b\x0c\x0e-\x1f]/', UTF8_REPLACEMENT, $str );
$str = str_replace( UTF8_FFFE, UTF8_REPLACEMENT, $str );
$str = str_replace( UTF8_FFFF, UTF8_REPLACEMENT, $str );
# UnicodeString constructor fails if the string ends with a head byte.
# Add a junk char at the end, we'll strip it off
return rtrim( utf8_normalize( $str . "\x01", UNORM_NFC ), "\x01" );
}
randomString (   $length,
  $nullOk,
  $ascii = false 
)

Definition at line 41 of file RandomTest.php.

References $out.

{
$out = '';
for( $i = 0; $i < $length; $i++ )
$out .= chr( mt_rand( $nullOk ? 0 : 1, $ascii ? 127 : 255 ) );
return $out;
}
showDiffs (   $a,
  $b 
)

Definition at line 64 of file RandomTest.php.

{
$ota = explode( "\n", str_replace( "\r\n", "\n", $a ) );
$nta = explode( "\n", str_replace( "\r\n", "\n", $b ) );
$diffs = new Diff( $ota, $nta );
$formatter = new TableDiffFormatter();
$funky = $formatter->format( $diffs );
$matches = array();
preg_match_all( '/<(?:ins|del) class="diffchange">(.*?)<\/(?:ins|del)>/', $funky, $matches );
foreach( $matches[1] as $bit ) {
$hex = bin2hex( $bit );
echo "\t$hex\n";
}
}
$size = 16;
$n = 0;
while( true ) {
$n++;
echo "$n\n";
$str = randomString( $size, true);
$clean = UtfNormal::cleanUp( $str );
$norm = donorm( $str );
echo strlen( $clean ) . ", " . strlen( $norm );
if( $clean == $norm ) {
echo " (match)\n";
} else {
echo " (FAIL)\n";
echo "\traw: " . bin2hex( $str ) . "\n" .
"\tphp: " . bin2hex( $clean ) . "\n" .
"\ticu: " . bin2hex( $norm ) . "\n";
echo "\n\tdiffs:\n";
showDiffs( $clean, $norm );
die();
}
$str = '';
$clean = '';
$norm = '';
}

Variable Documentation

$n = 0

Definition at line 80 of file RandomTest.php.

Referenced by HTMLPurifier_Token\__get(), Text_Diff_Engine_native\_diag(), PHPExcel_Calculation_Functions\_erfcVal(), ilExternalFeed\_getRSSLocation(), PHPExcel_Calculation_Functions\_incompleteGamma(), _DiffEngine\_lcs_pos(), HTTP_WebDAV_Server\_new_uuid(), ilBMFTransport_HTTP\_parseEncoding(), PHPExcel_Reader_Excel5_Escher\_readOfficeArtRGFOPTE(), PHPExcel_Calculation_Functions\_romanCut(), wsdl\addComplexType(), ilBMFWSDL\addNamespace(), wsdl\addOperation(), HTML5TreeConstructer\appendToRealParent(), ilPCParagraph\autoSplit(), PHPExcel_Calculation_Functions\BESSELI(), PHPExcel_Calculation_Functions\BESSELJ(), PHPExcel_Calculation_Functions\BESSELK(), PHPExcel_Calculation_Functions\BESSELY(), soap_parser\buildVal(), nusoap_parser\buildVal(), ilvCard\buildVCard(), ilObjLanguage\check(), ilObjSCORM2004LearningModuleGUI\collapseAll(), HTMLPurifier_UnitConverter\convert(), HTML5TreeConstructer\elementInScope(), ilObjSCORM2004LearningModuleGUI\expandAll(), UtfNormal\fastCombiningSort(), UtfNormal\fastCompose(), UtfNormal\fastDecompose(), LagrangeInterpolation\findPolynomialFactors(), ilFeedback\getChartData(), HTMLPurifier_HTMLModuleManager\getElements(), DifferenceEngine\getMultiNotice(), ilMilestoneResponsiblesTableGUI\getParticipantsAndResponsibles(), nusoap_base\getPrefixFromNamespace(), HTMLPurifier_UnitConverter\getSigFigs(), HTMLPurifier_Injector_SafeObject\handleElement(), hexSequenceToUtf8(), TCPDFBarcode\imb_tables(), ilPCTable\importCellAttributes(), ilPCTable\importHtml(), ilPCTable\importRow(), ilPCTable\importTableAttributes(), ilObjUserFolderGUI\importUserRoleAssignmentObject(), HTML5TreeConstructer\inBody(), ilPageObject\insertSourceCodeParagraphs(), HTML5TreeConstructer\inTable(), Base\interquartileMean(), Title\isDeleted(), PHPExcel_Calculation_Functions\LARGE(), EvalMathStack\last(), PHPExcel_Token_Stack\last(), PHPExcel_Reader_Excel5\load(), MagicSquareExample\magic(), MagicSquareExample\main(), Title\makeName(), Base\median(), ilBMFType_duration\mkduration(), ilPersonalDesktopGUI\multiarray_sort(), Title\nameOf(), PHPlot\pad_array(), polyfit(), ilStatistics\product_n(), Base\productN(), ilStatistics\quantile(), UtfNormal\quickIsNFC(), UtfNormal\quickIsNFCVerify(), ilObjSCORM2004LearningModule\readObject(), ilObjSCORMLearningModule\readObject(), ilCalendarEntry\readResponsibleUsers(), HTML5TreeConstructer\resetInsertionMode(), HTMLPurifier_UnitConverter\round(), Benchmark\run(), Benchmark\runCholesky(), Benchmark\runEig(), Benchmark\runLU(), Benchmark\runQR(), Benchmark\runSVD(), Base\sampleCentralMoment(), Base\sampleRawMoment(), wsdl\serializeType(), PHPExcel_Calculation_Functions\SERIESSUM(), php4DOMNode\set_namespace(), CASClient\setCacheTimesForAuthRecheck(), phpCAS\setCacheTimesForAuthRecheck(), PHPlot\SetNumHorizTicks(), PHPlot\SetNumVertTicks(), HTMLPurifier_HTMLModuleManager\setup(), ilObjSCORM2004LearningModuleGUI\showTree(), PHPExcel_Calculation_Functions\SMALL(), ilStatistics\sum_n(), Base\sumN(), ilObjUserTest\testCreateSetLookupDelete(), TestMatrix\TestMatrix(), and tile().

$size = 16

Definition at line 79 of file RandomTest.php.

Referenced by ilDiskQuotaChecker\__updateDiskUsageReportOfType(), ilObjMediaObject\_determineWidthHeight(), ilObjMediaObjectGUI\_getMediaInfoHTML(), PHPExcel_Reader_Excel5\_getNextToken(), ilObjForumAccess\_lookupDiskUsage(), ilObjMediaCastAccess\_lookupDiskUsage(), ilFileDataMail\_lookupDiskUsageOfUser(), ilObjFileAccess\_lookupFileSize(), ilObjFileAccess\_lookupFileSizeFromFilesystem(), ilContainer\_lookupIconPath(), ilBMFBase\_multiArrayType(), PHPExcel_Writer_Excel5_Worksheet\_processBitmap(), Spreadsheet_Excel_Writer_Worksheet\_processBitmap(), PHPExcel_Reader_Excel5\_readBIFF8Constant(), PHPExcel_Reader_Excel5\_readBIFF8ConstantArray(), PHPExcel_Reader_Excel5_Escher\_readBSE(), PHPExcel_Reader_Excel5\_readFont(), OLE\_readPpsWks(), PHPExcel_Shared_OLERead\_readPropertySets(), ilObjMediaObject\_saveTempFileAsMediaObject(), ilMediaItem\addAreaToMapWorkCopy(), ilPageObject\addFileSizes(), ilInfoScreenGUI\addObjectSections(), PHPExcel_Writer_Excel5_Escher\close(), PHPExcel_Calculation_Functions\CONFIDENCE(), ilUtil\dirsize(), HTMLPurifier_Strategy_FixNesting\execute(), HTMLPurifier_Strategy_MakeWellFormed\execute(), ilMediaCastTableGUI\fillRow(), ilMediaPoolTableGUI\fillRow(), ilFormat\formatFloat(), ilFormat\formatSize(), ilUtil\formSelect(), HTMLPurifier_Generator\generateFromTokens(), ilUpdateUtilsMailMigration\getDir(), ilUpdateUtils\getDir(), ilUtil\getDir(), ilObjMediaObjectGUI\getFullscreenSizeObject(), getid3_tar\getid3_tar(), PHPlot\GetImage(), assFileUpload\getMaxFilesizeAsString(), ilMediaItem\getOriginalSize(), Net_Socket\gets(), ilMDTechnical\getSize(), ilObjMediaObjectGUI\getStandardSizeObject(), getid3_lib\hash_data(), HTTP_WebDAV_Server\http_GET(), ilObjectFeedWriter\ilObjectFeedWriter(), TCPDFBarcode\imb_tables(), PHPExcel_Writer_Excel5_Worksheet\insertBitmap(), Spreadsheet_Excel_Writer_Worksheet\insertBitmap(), ilMediaAliasItem\makeMapWorkCopy(), ilMediaItem\makeMapWorkCopy(), PHPlot\pad_array(), HTMLPurifier_Lexer_DirectLex\parseAttributeString(), Net_Socket\read(), ilUtil\resizeImage(), Spreadsheet_Excel_Writer_Worksheet\setPaper(), Spreadsheet_Excel_Writer_Format\setSize(), Net_Socket\setWriteBuffer(), ilGlossaryPresentationGUI\showDownloadList(), ilLMPresentationGUI\showDownloadList(), ilMailFormGUI\showForm(), HTMLPurifier_TagTransform_Font\transform(), HTMLPurifier_AttrDef_CSS_Font\validate(), and Net_Socket\write().

if(php_sapi_name()!= 'cli')

Definition at line 29 of file RandomTest.php.