Code Monkey home page Code Monkey logo

printftester's People

Contributors

nicolasgasco avatar pandaero avatar tripouille avatar vln37 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

printftester's Issues

Unmmatching valgrind error messages in tester

Been using the tester, and was puzzled with the following valgrind errors:

83.OK ==6020== Invalid read of size 1
==6020==    at 0x11076C: ft_parse_width (in /mnt/c/Users/madeb/Documents/42 Madrid/GitHub/42-Madrid-Cursus/ft_printf/printfTester/d_test)
==6020==    by 0x1109E0: ft_parse (in /mnt/c/Users/madeb/Documents/42 Madrid/GitHub/42-Madrid-Cursus/ft_printf/printfTester/d_test)
==6020==    by 0x110616: ft_printf (in /mnt/c/Users/madeb/Documents/42 Madrid/GitHub/42-Madrid-Cursus/ft_printf/printfTester/d_test)
==6020==    by 0x10E871: void print<int, int>(char const*, int, int) (print.hpp:66)
==6020==    by 0x10DEFE: main (d_test.cpp:111)
==6020==  Address 0x4d870bf is 1 bytes before a block of size 4 alloc'd
==6020==    at 0x483E77F: malloc (vg_replace_malloc.c:307)
==6020==    by 0x11142E: ft_substr (in /mnt/c/Users/madeb/Documents/42 Madrid/GitHub/42-Madrid-Cursus/ft_printf/printfTester/d_test)
==6020==    by 0x1105F6: ft_printf (in /mnt/c/Users/madeb/Documents/42 Madrid/GitHub/42-Madrid-Cursus/ft_printf/printfTester/d_test)
==6020==    by 0x10E871: void print<int, int>(char const*, int, int) (print.hpp:66)
==6020==    by 0x10DEFE: main (d_test.cpp:111)
==6020==

I ended up redoing my code to never use malloc (I was using ft_substr), but the same message appears every time. I started debugging more thoroughly and eventually noticed that the above error message shows issues with ft_substr, and I no longer use that function. Also, I got to an older commit which didn't have the Valgrind issue. After running the tester in the old version the above Valgrind errors disappeared and they don't show up anymore, not even after running the test in my current commit.

Any ideas as to why that is happening? Thank you!

Wrong test number on minus

Hello, first i wan't to thanks you for this beautifull tester

Secondly, i found that the test 71 is doubled in the minus part of the tester. this cause the rest of the test to be out of sync

I have made a fork that fix this, this will help :)

Unnecessary 's' tests on bonus 'space' flag

Discussed in #7

Originally posted by denisgodoy September 16, 2021
Hi! I'm currently doing the project (new pdf) and using the tester, but I've faced a problem with bonus part2. According to man BSD, the 'space' flag has no effect on 's' conversions, however the tester does expect them. I'm doing bonus2 only, as the new pdf allows me to manage it partially, so I will not implement field width, '0', '.' and '-'. I'd like to ask if the tester is not correctly updated or is it related to Moulinette and the '% 1s' conversion?

According to man the space flag has no effect on s conversions. Earlier I opened a discussion on this repo about it.

' ' (space) A blank should be left before a positive number produced by a signed conversion (a, A, d, e, E, f, F, g, G, or i). - https://www.freebsd.org/cgi/man.cgi?printf(3)

I believe the following tests are not really necessary, as I just got graded 110 - did bonus part 2 only, which does not manage field width, -, 0 and ., as the new pdf allows me to do them partially. Got a false KO on the tester.

space_test.cpp

SUBCATEGORY(1, 9, cout << endl << FG_LGRAY << "subcategory: s" << RESET_ALL << endl;)
	TEST(1, print("% s", ""));
	TEST(2, print(" % 1s", ""));
	TEST(3, print("% 1s ", ""));
	TEST(4, print(" % s ", ""));
	TEST(5, print(" % s ", "-"));
	TEST(6, print(" % s % s ", "", "-"));
	TEST(7, print(" % s % s ", " - ", ""));
	TEST(8, print(" % s % s % s % s ", " - ", "", "4", ""));
	TEST(9, print(" % s % s % s % s % s ", " - ", "", "4", "", "2 "));

how to fast

where is your wait/pause, i can't wait 2h between each lines mate :(

Hexadecimal tests passing in spite of mistake

Hi! Great work as usual with these tests 👍
I found a small issue, which may not be an issue at all, but still...

When converting from decimal to hexadecimal, I have a condition to check if the remainder of the number to be converted is smaller than 10 (and therefore it must be 0-9) or bigger than 9 (there it must be A-F).
I made a mistake and wrote it like this:

if (hex % 16 <= 10)
    ft_putnbr(hex % 16, counter);
else
   *counter += write(1, &alpha[hex % 16 - 10], 1);

The <= in line 1 is wrong and I was getting e.g. 210 instead of 2A for 42 (the decimal). I noticed because the mix test was failing, but all the x/X ones were good. I haven't looked further into it, but I think that it would be as easy as adding a 42 in the x/X tests to flag this kind of error sooner.

Thanks!

Doesn't test when a percent is followed by a non-flag char.

If you pass a percent sign followed by a flag which is illegal, the original printf prints both the percent sign and the following character, and so should ft_printf.

I hadn't considered this and found out by testing it manually.

Example:

int main()
{
	printf("this is a test %w\n");
	ft_printf("this is a test %w\n");
	return (0);
}

stdout:

@herbievine ➜ /workspaces/42/ft_printf (main ✗) $ ./a.out 
this is a test %w
this is a test 

Just something to consider adding.

/usr/bin/ld: cannot find -lftprintf: No such file or directory

Hi, this probably has nothing to do with the library. I'm not able to study at 42 for a few days. Stuck home with a Ubuntu laptop. Cannot run the tests. Would really appreciate if you could help me, thanks!


make[1]: Entering directory '/home/berkay/Desktop/ft_printf'
gcc -Wall -Wextra -Werror   -c -o ft_printf.o ft_printf.c
gcc -Wall -Wextra -Werror   -c -o ft_printhex.o ft_printhex.c
gcc -Wall -Wextra -Werror   -c -o ft_printnbr.o ft_printnbr.c
gcc -Wall -Wextra -Werror   -c -o ft_printpercent.o ft_printpercent.c
gcc -Wall -Wextra -Werror   -c -o ft_printpointer.o ft_printpointer.c
gcc -Wall -Wextra -Werror   -c -o ft_printstr.o ft_printstr.c
gcc -Wall -Wextra -Werror   -c -o ft_printunsigned.o ft_printunsigned.c
ar rcs ft_printf.a ft_printf.o ft_printhex.o ft_printnbr.o ft_printpercent.o ft_printpointer.o ft_printstr.o ft_printunsigned.o
make[1]: Leaving directory '/home/berkay/Desktop/ft_printf'
[Mandatory]
/usr/bin/ld: cannot find -lftprintf: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:26: c] Error 1

make bonus error

Testing of the bonus part is no longer working, and it shows that it's up to date.
Screen Shot 2021-06-15 at 7 31 20 PM

Bonus Part

image

minus test : sub s - 1 & sub p 1 be tested with no minus.
Should I handle this case?
image

space test : sub s - I tested with printf(), it's show
image

Should I handle this case too?
image

String returns incorrect value with a big string

Moulinette killed my friend with a big string.

Test the return value with:
Mussum Ipsum, cacilds vidis litro abertis. Posuere libero varius. Nullam a nisl ut ante blandit hendrerit. Aenean sit amet nisi. Atirei o pau no gatis, per gatis num morreus. Copo furadis é disculpa de bebadis, arcu quam euismod magna. Si num tem leite então bota uma pinga aí cumpadi! Diuretics paradis num copo é motivis de denguis. Todo mundo vê os porris que eu tomo, mas ninguém vê os tombis que eu levo! Mais vale um bebadis conhecidiss, que um alcoolatra anonimis. Casamentiss faiz malandris se pirulitá. A ordem dos tratores não altera o pão duris. Nullam volutpat risus nec leo commodo, ut interdum diam laoreet. Sed non consequat odio. Per aumento de cachacis, eu reclamis. Nec orci ornare consequat. Praesent lacinia ultrices consectetur. Sed non ipsum felis.

Check the len of return;
unknown
unknown2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.