Wicri:Dilib source, module CharSet, Test : Différence entre versions
De Wicri Outils
imported>Jacques Ducloy |
imported>Jacques Ducloy m (24 révisions importées) |
||
(18 révisions intermédiaires par 2 utilisateurs non affichées) | |||
Ligne 1 : | Ligne 1 : | ||
+ | {{Dilib header|module=CharSet}} | ||
Cette page introduit les sources du programme de test de non régression du module CharSet. | Cette page introduit les sources du programme de test de non régression du module CharSet. | ||
− | ==Fichier | + | ==Fichier charSet.test.sh== |
− | <source lang="sh" dilib:file="CharSet/Test/charSet.test.sh"> | + | <source lang="sh" dilib:file="Import/CharSet/Test/charSet.test.sh"> |
#!/bin/sh | #!/bin/sh | ||
Ligne 18 : | Ligne 19 : | ||
echo \| | echo \| | ||
− | + | gcc $DILIB_IMPORT/CharSet/Test/charSet.genChar.c $DILIB_CC -o $DILIB/MakeDir/charSet.genChar | |
− | + | ||
− | ... | + | $DILIB/MakeDir/charSet.genChar > $DILIB/MakeDir/CharSet.test.data.txt |
− | + | ||
+ | CharSetTr a2o < $DILIB/MakeDir/CharSet.test.data.txt \ | ||
+ | | CharSetTr o2a > $DILIB/MakeDir/CharSet.test.target.txt | ||
diff $DILIB/MakeDir/CharSet.test.data.txt \ | diff $DILIB/MakeDir/CharSet.test.data.txt \ | ||
Ligne 35 : | Ligne 38 : | ||
rm $DILIB/MakeDir/CharSet.test.target.txt | rm $DILIB/MakeDir/CharSet.test.target.txt | ||
rm $DILIB/MakeDir/CharSet.test.diff | rm $DILIB/MakeDir/CharSet.test.diff | ||
+ | rm $DILIB/MakeDir/charSet.genChar | ||
fi | fi | ||
+ | </source> | ||
+ | |||
+ | ==Fichier charSet.genChar.c== | ||
+ | <source lang="c" dilib:file="Import/CharSet/Test/charSet.genChar.c"> | ||
+ | #include <stdlib.h> | ||
+ | #include <stdio.h> | ||
+ | #include <string.h> | ||
+ | |||
+ | |||
+ | int main(void) | ||
+ | { | ||
+ | int i; | ||
+ | int c; | ||
+ | |||
+ | for(i = 1; i <= 255; ++i) | ||
+ | { | ||
+ | printf ("%c %d %X\n", i, i, i); | ||
+ | } | ||
+ | return EXIT_SUCCESS; | ||
+ | } | ||
</source> | </source> | ||
==Mise en œuvre== | ==Mise en œuvre== | ||
− | Exécuter sous le répertoire $ | + | Exécuter sous le répertoire $DILIB_ROOT les commandes suivantes : |
<source lang="sh"> | <source lang="sh"> | ||
WicriGetPage -l wicri-outils.fr -p "Wicri:Dilib source, module CharSet, Test" \ | WicriGetPage -l wicri-outils.fr -p "Wicri:Dilib source, module CharSet, Test" \ | ||
| MediaWikiExtractSources -w | HfdStoreFile | | MediaWikiExtractSources -w | HfdStoreFile | ||
+ | </source> | ||
+ | ;Test local: | ||
+ | <source lang="sh"> | ||
+ | sh $DILIB_IMPORT/CharSet/Test/charSet.test.sh | ||
</source> | </source> | ||
[[Catégorie:Dilib source|CharSet Test]] | [[Catégorie:Dilib source|CharSet Test]] |
Version actuelle datée du 16 juin 2017 à 19:03
Module CharSet |
Cette page introduit les sources du programme de test de non régression du module CharSet.
Fichier charSet.test.sh
#!/bin/sh
#
# module CharSet
#
#
# ATTENTION : Source de référence sur le wiki Wicri/Outils
# Page : Wicri:Dilib source, module CharSet, Test
#
echo \|-------------------------------------- module CharSet
echo \|
gcc $DILIB_IMPORT/CharSet/Test/charSet.genChar.c $DILIB_CC -o $DILIB/MakeDir/charSet.genChar
$DILIB/MakeDir/charSet.genChar > $DILIB/MakeDir/CharSet.test.data.txt
CharSetTr a2o < $DILIB/MakeDir/CharSet.test.data.txt \
| CharSetTr o2a > $DILIB/MakeDir/CharSet.test.target.txt
diff $DILIB/MakeDir/CharSet.test.data.txt \
$DILIB/MakeDir/CharSet.test.target.txt \
> $DILIB/MakeDir/CharSet.test.diff
if test -s $DILIB/MakeDir/CharSet.test.diff
then
echo CharSet "****************************** ERROR CharSet *****"
else
echo ----- CharSet Test 1 OK
rm $DILIB/MakeDir/CharSet.test.data.txt
rm $DILIB/MakeDir/CharSet.test.target.txt
rm $DILIB/MakeDir/CharSet.test.diff
rm $DILIB/MakeDir/charSet.genChar
fi
Fichier charSet.genChar.c
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(void)
{
int i;
int c;
for(i = 1; i <= 255; ++i)
{
printf ("%c %d %X\n", i, i, i);
}
return EXIT_SUCCESS;
}
Mise en œuvre
Exécuter sous le répertoire $DILIB_ROOT les commandes suivantes :
WicriGetPage -l wicri-outils.fr -p "Wicri:Dilib source, module CharSet, Test" \
| MediaWikiExtractSources -w | HfdStoreFile
- Test local
sh $DILIB_IMPORT/CharSet/Test/charSet.test.sh