[ccan] iniparser almost done, a couple of questions before uploading

Rusty Russell rusty at rustcorp.com.au
Thu Apr 2 22:59:05 EST 2009


On Thursday 02 April 2009 18:35:08 Tim Post wrote:
> Hi,
> 
> I am almost done with iniparser, I have finished the unit tests:

Hi Tim,
	Sweet!

> I have tests written for all non void functions, is that adequate
> coverage?

I wasn't planning on explicitly setting requirements.  The GSoC student(s)
will integrate coverage testing into ccanlint so it'll be up to people reading
the ccanlint scores to decide whether your coverage is high enough I guess.

> For instance, iniparser_unset() is actually void, but the test
> is examining its results (making sure it did its job) via
> iniparser_getstring(). The checks for iniparser_freedict() (which
> actually frees the dictionary structure) would be up to valgrind? So
> though the test says iniparser_unset(), its actually confirmed via
> iniparser_getstring(), is that alright?

Yes, running the tests under valgrind is also on the GSoC TODO.

> That leads me to my second question. I have 4 instances of uninitialized
> variables that valgrind reports, fixing this involves a bit of
> refactoring. The code works, withstands abuse and doesn't leak, can I
> just upload what I've done now and refactor later?

I've uploaded before I've written decent tests before; I wouldn't sweat
too much.  Plus, it gives something to strive for if the new-improved-
post-GSoC-ccanlint finds issues, you get to fix them.

> Incidentally, TAP exposed a few bugs, I don't know what I did without
> it. It really makes testing easy. Today I plowed through writing unit
> tests for two libraries in just over an hour's time :)

Yes, it is quite sweet.  Our setup isn't optimal (again, the aim is for
ccanlint to drive the tests) but it's shown its value and it's *simple*.
We owe the perl guys a beer...

Cheers!
Rusty.



More information about the ccan mailing list