|
From: Pedro A. <pa...@dc...> - 2007-09-11 18:57:39
|
On Mon, 10 Sep 2007 23:49:09 +0100 Guilherme Santos <gui...@gm...> wrote: > Speaking on tests. > I'm using CppUnit to keep my tests organized (I have only one at this > moment). Another advantage is that is easy to add or remove tests and > keep everything running. > > But this approach has several disadvantages too. > It's implemented in C++ and if we think in (possible) future > platforms such as mobile, it could be more complicated to get the > framework compiling for that platforms. > > Anyway, it's easy to copy the tests code and use it to build a > simpler test unit. > > What are you planning to test the freekode? > If you guys think it's better to build another approach, it's easy > for me to copy the code I have done. > > For the moment, I'll continue to use the cppunit to test my stuff :) > > > Cheers, > Guilherme Santos Hi Guilherme, I've also been thinking about this, and to make the code as portable as possible we probably should create our own mini test suite in ANSI C and expand it as need arises. I've had some experience testing C code with Check and although it's cleverly designed to avoid C's pitfalls in regards to testing code, it falls a bit short on portability for more exotic platforms because it relies on certain UNIX functions like fork() and vsnprintf(). A few years back I tried porting it to a DEC Alpha workstation only to realize that not all UNIX environments have vsnprintf()... Since openKode targets embedded platforms I'm expecting that we can't count on much more than a working ANSI C compiler. So anyway, back to the idea of a minimalistic test framework what do you guys prefer: a) Each test is an executable in a special "test dir" and a test runner app runs each test it finds via system() and reports the output. b) Each test is a function (usually a macro) and the test runner just calls the functions iteratively (this usually requires a fork() to avoid a bad test crashing the test runner) I'm currently leaning towards option a) but I can use whatever alternative you feel more comfortable with. Cheers, p. |