2018-09-20 19:28:26 +02:00
|
|
|
<?php
|
|
|
|
|
2020-05-06 12:17:35 +02:00
|
|
|
require(realpath(dirname(__FILE__)).'/../src/includes/functions.php');
|
2018-09-20 19:28:26 +02:00
|
|
|
|
|
|
|
$tests=array(
|
|
|
|
// array(format, test val, test good result)
|
|
|
|
array('%{toto:2}', 'abcdef', 'ab'),
|
|
|
|
array('%{toto:3:-2}', 'abcdef', 'bc'),
|
|
|
|
array('%{toto:1:0}', 'abcdef', 'bcdef'),
|
|
|
|
array('%{toto:-2}', 'abcdef', 'ef'),
|
|
|
|
array('%{toto:-3:2}', 'abcdef', 'de'),
|
|
|
|
array('%{toto:-1}', 'abcdef', 'f'),
|
|
|
|
array('%{toto!}', '<a>tiTé', '<A>TITÉ'),
|
|
|
|
array('%{toto_}', '<a>tiTé', '<a>tité'),
|
|
|
|
array('%{toto~}', '<a>tiTé', '<a>tiTe'),
|
|
|
|
array('%{toto%}', '<a>tiTé', '<a>tiTé'),
|
|
|
|
array('%{toto!%}', '<a>tiTé', '<A>TITÉ'),
|
|
|
|
array('%{toto!~}', '<a>tiTé', '<A>TITE'),
|
|
|
|
array('%{toto!~%}', '<a>tiTé', '<A>TITE'),
|
|
|
|
array('%{toto:1!%}', '<a>tiTé', '<'),
|
|
|
|
array('%{toto:1:0!~}', '<a>tiTé', 'A>TITE'),
|
|
|
|
array('%{toto:-3!~%}', '<a>tiTé', 'ITE'),
|
|
|
|
array('%{toto:-3:2!~%}', '<a>tiTé', 'IT'),
|
|
|
|
);
|
|
|
|
|
|
|
|
foreach ($tests as $test) {
|
|
|
|
$result = getFData($test[0], $test[1]);
|
|
|
|
$ok = (($result == $test[2])?'OK':"\n\t!!!! NOK !!!!");
|
|
|
|
echo "Test : \"$test[0]\" ($test[2]) : \"$test[1]\" -> \"$result\" => $ok\n";
|
|
|
|
}
|