Skip to content

Instantly share code, notes, and snippets.

@lambda2
Created December 6, 2013 06:53
Show Gist options
  • Select an option

  • Save lambda2/7819633 to your computer and use it in GitHub Desktop.

Select an option

Save lambda2/7819633 to your computer and use it in GitHub Desktop.
Petits tests pour le ft_ls
-t#.
-t#..
-l#.
-l#..
-t#
-l#
-la#
-lar#
-lart#
-la#
-lart#
-l#../..
-a#../..
-la#../..
-r#../..
-lr#../..
-lar#../..
-lart#../..
#../../../Sandbox/ls
-l#../../../Sandbox/ls
-la#../../../Sandbox/ls
-lr#../../../Sandbox/ls
-lar#../../../Sandbox/ls
-la -r#../../../Sandbox/ls
-lat#../../../Sandbox/ls
-lart#../../../Sandbox/ls
-l#/
-la#/
-lat#/
-lart#../../sandbox/ls
-lat#../../sandbox/ls
-lt#../../sandbox/ls
-lRt#../../sandbox/ls
-larRt#../../../Sandbox/ls
-a#../ft_*
-t#../ft_*
-at#../ft_*
-art#../ft_*
-R#../ft_*
-Ra#../ft_*
-Rat#../ft_*
-Ratr#../ft_*
-ar#../ft_* ..
-a#../ft_* ..
-t#../ft_* ..
-at#../ft_* ..
-art#../ft_* ..
-R#../ft_* ..
-Ra#../ft_* ..
-Rat#../ft_* ..
-Ratr#../ft_* ..
-ar#../* ../../c* ../b*
-art#../* ../../c* ../b*
-arRRR#../* ../../c* ../b*
-arRt#../* ../../c* ../b*
-arlRRRa#../* ../../c* ../b*
-al#../* ../../c* ../b*
-l#./evil
-laR#./evil
-R#./evil ./*
#!/bin/bash
ft_ls=~/Dev/s1/ftls/ft_ls
tempDir=~/Dev/Tmp
function test
{
a=`$ft_ls $1 $2`
b=`ls $1 $2 | cat`
#echo "[$a] [$b]"
c=`diff <(echo "$a") <(echo "$b")`
echo -n "For directory $2 : "
if [ -z "$c" ]; then
printf '\033[1;32m'
echo "Success ! "
printf '\033[0m'
else
printf '\033[1;31m'
echo "Fail. [ ft_ls "$1" "$2" ]"
printf '\033[1;31m'
printf '\033[0m'
printf '\033[1;33m'
echo -n "Voir le diff ? [y/N]"
printf '\033[1;31m'
read resp
if [ -z $resp ]; then
# vimdiff <(echo "$a") <(echo "$b")
# exit
echo "..."
elif [ $resp == "y" ]; then
vimdiff <(echo "$a") <(echo "$b")
exit
fi
fi
}
for testR in `cat tests.rules`
do
args=`echo $testR | cut -d "#" -f1`
name=`echo $testR | cut -d "#" -f2`
test $args $name
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment