Import initial de Vivier depuis l'hebergement OVH
This commit is contained in:
commit
839e5e57c5
126 files changed
+22447
No files matched your search
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
// Tests du découpage en termes et du lecteur de rapports : php tests/test_recherche.php
|
||||
declare(strict_types=1);
|
||||
const SENIORITES = ['junior' => 'Junior', 'intermediaire' => 'Intermédiaire', 'confirme' => 'Confirmé', 'expert' => 'Expert'];
|
||||
const STATUTS = ['recu' => 'Reçu'];
|
||||
require __DIR__ . '/../src/Recherche.php';
|
||||
require __DIR__ . '/../src/markdown.php';
|
||||
|
||||
$ok = 0; $ko = 0;
|
||||
function verifier(string $nom, bool $cond): void {
|
||||
global $ok, $ko;
|
||||
if ($cond) { $ok++; } else { $ko++; echo "ECHEC : $nom\n"; }
|
||||
}
|
||||
$t = static fn (string $s, bool $d = true): array => Recherche::termes($s, $d);
|
||||
|
||||
verifier('minuscules et accents', $t('Développeur Sénior') === ['developpeur', 'senior']);
|
||||
verifier('c# conservé', in_array('c#', $t('C# et Java'), true));
|
||||
verifier('c++ conservé', in_array('c++', $t('Expert C++.'), true));
|
||||
verifier('.NET reconnu', in_array('dotnet', $t('ASP .NET Core'), true));
|
||||
verifier('node.js entier et décomposé', !array_diff(['node.js', 'node', 'js'], $t('Node.js')));
|
||||
verifier('ci/cd entier et décomposé', !array_diff(['ci/cd', 'ci', 'cd'], $t('CI/CD')));
|
||||
verifier('full-stack entier et décomposé', !array_diff(['full-stack', 'full', 'stack'], $t('Full-Stack')));
|
||||
verifier('requête non décomposée', $t('full-stack', false) === ['full-stack']);
|
||||
verifier('apostrophe séparatrice', $t("d'applications") === ['d', 'applications']);
|
||||
verifier('ponctuation finale retirée', $t('Java, Spring.') === ['java', 'spring']);
|
||||
verifier('lettre seule gardée', in_array('r', $t('R et Python'), true));
|
||||
verifier('œ développé', $t('Cœur') === ['coeur']);
|
||||
|
||||
$html = markdown_vers_html("# Titre\n\nTexte **gras** et <script>x</script>\n\n- un\n- deux\n\n| a | b |\n|---|---|\n| 1 | 2 |\n");
|
||||
verifier('titre décalé d\'un niveau', str_contains($html, '<h2>Titre</h2>'));
|
||||
verifier('gras', str_contains($html, '<strong>gras</strong>'));
|
||||
verifier('HTML du fichier neutralisé', !str_contains($html, '<script>') && str_contains($html, '<script>'));
|
||||
verifier('liste', str_contains($html, "<ul>\n<li>un</li>\n<li>deux</li>\n</ul>"));
|
||||
verifier('tableau', str_contains($html, '<th>a</th>') && str_contains($html, '<td>2</td>'));
|
||||
|
||||
echo "$ok réussis, $ko échoués\n";
|
||||
exit($ko > 0 ? 1 : 0);
|
||||
Reference in new issue
Block a user