mcyprian/IFJ15

dynamic_buffer tests

radosroka opened this issue · 3 comments

Dynamic Buffer tests are available now, but only for some functions.
I will add rest of tests for dynamic_buffer tommorow maybe...

Dynamic Buffer seqfaults often and it's important to avoid that situation.
Other problem is that "add" function cannot add '\0' to string without moving of index. Maybe the clever way is make a function that move with index in dynamic_buffer structure and don't allow add '\0' via add function or set index to new place in add function after add something contains '\0'.
I think that little consultation maybe resolves our problem.

Test is in tests/dynbuff_test.c and after init.sh is available log in tests/dynbuff_test.log.
You can look at this commit 4ae1ca8

Thanks for review,
I am not testing TDynamic pointer for NULL, that si true, I will also try to improve add_char behaviour when c arguments is'\0'.

I found something else.

Maybe get_char is redundant because get_str(.., 1) does the same thing and I'm not sure if get_str make sense, in tokenize modul will be better function to parse and they get entire buffer as parameter.

Empty_buffer doesn't set '\0' at zero index.

And for sure, what supposed to do get_str(&buff, 0); ?

This problem was resolved after conversation.