ajout du script pour tester le cas chelous de la precision 0
This commit is contained in:
1
Makefile
1
Makefile
@@ -33,6 +33,7 @@ LFLAGS = -L$(LDIR) -l$(LIBS)
|
|||||||
all: $(NAME)
|
all: $(NAME)
|
||||||
|
|
||||||
$(NAME): $(ODIR) $(OBJS) $(DEPS)
|
$(NAME): $(ODIR) $(OBJS) $(DEPS)
|
||||||
|
make -C $(LDIR)
|
||||||
cp $(LDIR)$(_LIBS) ./
|
cp $(LDIR)$(_LIBS) ./
|
||||||
mv $(_LIBS) $(NAME)
|
mv $(_LIBS) $(NAME)
|
||||||
ar -rc $@ $(OBJS)
|
ar -rc $@ $(OBJS)
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ char *convert_with_flags(char *s, va_list ap, char *type, int *size)
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
free(s);
|
free(s);
|
||||||
s = print;
|
s = print;
|
||||||
return(print);
|
return (print);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
2
main.c
2
main.c
@@ -300,8 +300,8 @@ int main(int ac, char **av)
|
|||||||
// PRINT("%.0i", 0);
|
// PRINT("%.0i", 0);
|
||||||
// PRINT("%.0i", 000);
|
// PRINT("%.0i", 000);
|
||||||
// PRINT("%.0X", 0);
|
// PRINT("%.0X", 0);
|
||||||
// PRINT("%.i", 0);
|
|
||||||
// PRINT("%08i", 33333);
|
// PRINT("%08i", 33333);
|
||||||
|
PRINT("%.i", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ////////////////////////////////////////////////////////////////// */
|
/* ////////////////////////////////////////////////////////////////// */
|
||||||
|
|||||||
40
script_loop_test.sh
Normal file
40
script_loop_test.sh
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
|
||||||
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||||
|
# script to launch a lot of time a program to see if it always output the same result #
|
||||||
|
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||||
|
|
||||||
|
let i=0
|
||||||
|
|
||||||
|
# launch the output, write it into the file temoin.txt, and echo the content
|
||||||
|
./a.out test > temoin.txt
|
||||||
|
echo '\033[32mfile temoin.txt contain this :\033[0m'
|
||||||
|
cat temoin.txt
|
||||||
|
|
||||||
|
# ask if the output was a good one, if so continue the script, otherwise retry
|
||||||
|
question=
|
||||||
|
while [ -z $question ]
|
||||||
|
do
|
||||||
|
echo '\033[32mis the output correct ? ok to continue ? n/y\033[0m'
|
||||||
|
read question
|
||||||
|
if [[ $question == 'n' ]]
|
||||||
|
then
|
||||||
|
./a.out test > temoin.txt
|
||||||
|
echo '\033[32mfile temoin.txt contain now this :\033[0m'
|
||||||
|
cat temoin.txt
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
question=
|
||||||
|
done
|
||||||
|
|
||||||
|
# launch the program in a loop and compare the output to the first one
|
||||||
|
./a.out test > exemple.txt
|
||||||
|
while diff temoin.txt exemple.txt
|
||||||
|
do
|
||||||
|
let i++
|
||||||
|
echo '\033[1;34m'$i'\033[0m'
|
||||||
|
./a.out test > exemple.txt
|
||||||
|
done
|
||||||
|
|
||||||
|
# clean the files created by the script
|
||||||
|
rm temoin.txt exemple.txt
|
||||||
@@ -98,7 +98,7 @@ char *width_flags(char *print, char *s, int width, int zero)
|
|||||||
int len;
|
int len;
|
||||||
|
|
||||||
len = ft_strlen(print) + zero;
|
len = ft_strlen(print) + zero;
|
||||||
if(!(tmp = ft_strnew(width)))
|
if (!(tmp = ft_strnew(width)))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
if (ft_strchr(s, '-'))
|
if (ft_strchr(s, '-'))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user