Atsushi Eno 0afb42d28e 2006-10-30 Atsushi Enomoto <[email protected]> 19 년 전
..
Makefile.am fb4751751c 2006-10-14 Miguel de Icaza <[email protected]> 19 년 전
README 24f7344136 2006-08-19 Aaron Bockover <[email protected]> 19 년 전
array.c 6809d60afc 2006-10-18 Gonzalo Paniagua Javier <[email protected]> 19 년 전
dir.c 310aa2cb39 This makes gacutil work\n2006-10-21 Miguel de Icaza <[email protected]> 19 년 전
driver.c c1228dfc99 2006-08-21 Aaron Bockover <[email protected]> 19 년 전
endian.c fb4751751c 2006-10-14 Miguel de Icaza <[email protected]> 19 년 전
fake.c c1228dfc99 2006-08-21 Aaron Bockover <[email protected]> 19 년 전
file.c 6ab04587a9 2006-08-31 Gonzalo Paniagua Javier <[email protected]> 19 년 전
hashtable.c 1c0e65e79f 2006-08-24 Miguel de Icaza <[email protected]> 19 년 전
list.c f088466ad8 * src/sort.frag.h (digit): Declare here based on externally 19 년 전
markup.c 2e4641e7ef Small improvements, but it still fails with the machine.config 19 년 전
path.c 03be2afdc4 2006-10-21 Miguel de Icaza <[email protected]> 19 년 전
pattern.c 28568f6b93 2006-08-28 Gonzalo Paniagua Javier <[email protected]> 19 년 전
ptrarray.c 256c358fd0 2006-08-27 Gonzalo Paniagua Javier <[email protected]> 19 년 전
queue.c fe3d43eee0 Removed unnecessary free() 19 년 전
shell.c a768092eca 2006-08-25 Gonzalo Paniagua Javier <[email protected]> 19 년 전
sizes.c 34b4ac7329 2006-10-15 Miguel de Icaza <[email protected]> 19 년 전
slist.c f088466ad8 * src/sort.frag.h (digit): Declare here based on externally 19 년 전
spawn.c f2b45610da 2006-10-07 Gonzalo Paniagua Javier <[email protected]> 19 년 전
string-util.c f6b278ad7e Another corner case, might be worth rewriting this routine 19 년 전
string.c a17adea98d Implement G_STRLOC 19 년 전
test-both bc434b09d7 2006-08-19 Aaron Bockover <[email protected]> 19 년 전
test.c 23c73a090c 2006-10-17 Miguel de Icaza <[email protected]> 19 년 전
test.h c1228dfc99 2006-08-21 Aaron Bockover <[email protected]> 19 년 전
tests.h fb4751751c 2006-10-14 Miguel de Icaza <[email protected]> 19 년 전
timer.c c1d700647e use fabs for comparing. It failed with -O2 19 년 전
utf8.c 0afb42d28e 2006-10-30 Atsushi Enomoto <[email protected]> 19 년 전
whats-implemented c9432db9ab 2006-08-20 Aaron Bockover <[email protected]> 19 년 전

README

EGlib Unit Testing
===============================================================================

1. Writing new tests
2. Using the test driver

===============================================================================
1. Writing new tests
===============================================================================

Tests are easy to write, but must be grouped in to logical cases. For instance,
the GPtrArray group has a number of tests that cover the entire GPtrArray
implementation.

These logical case groups should be in a single C file, and must have
three elements:

#include
#include "test.h"

...

...

static Test groupname_tests [] = {
{"groupname_test1", groupname_test1},
{"groupname_test1", groupname_test2},
{NULL, NULL}
};

DEFINE_TEST_GROUP_INIT(groupname_tests_init, groupname_tests)

A test implementation should look like:

RESULT groupname_test1()
{


if(test_failed) {
return FAILED("reason: %s", "this works like printf");
}

return OK; /* just NULL, but OK is cute */
}

Once a test group is written, it needs to be added to the groups table
in tests.h:

DEFINE_TEST_GROUP_INIT_H(groupname_tests_init) // same as in impl

static Group test_groups [] = {
...
{"groupname", groupname_tests_init}
...
};

===============================================================================
2. Using the test driver
===============================================================================

When tests are written, they are rebuilt with make. Two programs will be
built:

test-eglib: the test driver and tests linked against eglib
test-glib: the test driver and tests linked against system glib-2.0

Each driver program works exactly the same. Running test-eglib will run
the tests against eglib, and test-glib against glib-2.0.

The test driver supports a few options to allow for performance measuring:

--help show all options and available test groups
--time time the overall run and report it, even if --quiet is set
--quiet do not print test results, useful for timing
--iterations N run all or specified test groups N times

Run "test-eglib --help" for more details.

Example: run the ptrarray test group 100000 times and only print the time
it took to perform all iterations

./test-eglib -tqi 100000 ptrarray

Example: show single iteration of test output for two groups

./test-eglib ptrarray hashtable

Example: show test output of all available groups

./test-eglib

The 'test-both' script can be used to run both test-eglib and test-glib
with the same options back to back:

$ ./test-both -tqi 100000 ptrarray
EGlib Total Time: 1.1961s
GLib Total Time: 0.955957s

test-both also has a nice --speed-compare mode that shows comparison
information about EGlib vs GLib. It can run all tests or specific tests
with a configurable number of iterations. --speed-compare mode always runs
the drivers with -qtni

The syntax for --speed-compare is:

./test-both --speed-compare [ITERATIONS] [GROUPS...]

$ ./test-both --speed-compare Runs all tests with default iterations
$ ./test-both --speed-compare 500 Runs all tests with 500 iterations
$ ./test-both --speed-compare ptrarray Runs ptrarray test with default
iterations