diff options
author | Stef Walter <stef@memberwebs.com> | 2008-03-14 14:40:47 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2008-03-14 14:40:47 +0000 |
commit | 8865f7a28e40b82f98e944c8e7dbd67b56428bbc (patch) | |
tree | 1b51a96d8158b0758c304a7b72ff9c6d0cb2e533 /tests/cu-test/make-tests.sh | |
parent | 106dadfb63b371a1d5cf97ead46f975848e73786 (diff) |
Add unit tests
Diffstat (limited to 'tests/cu-test/make-tests.sh')
-rwxr-xr-x | tests/cu-test/make-tests.sh | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/cu-test/make-tests.sh b/tests/cu-test/make-tests.sh new file mode 100755 index 0000000..c651033 --- /dev/null +++ b/tests/cu-test/make-tests.sh @@ -0,0 +1,51 @@ +#!/usr/local/bin/bash + +# Auto generate single AllTests file for CuTest. +# Searches through all *.c files in the current directory. +# Prints to stdout. +# Author: Asim Jalis +# Date: 01/08/2003 + +if test $# -eq 0 ; then FILES=*.c ; else FILES=$* ; fi + +echo ' + +/* This is auto-generated code. Edit at your own peril. */ + +#include "CuTest.h" + +' + +cat $FILES | grep '^unit_test_' | + sed -e 's/(.*$//' \ + -e 's/$/(CuTest*);/' \ + -e 's/^/extern /' + +echo \ +' + +void RunAllTests(void) +{ + CuString *output = CuStringNew(); + CuSuite* suite = CuSuiteNew(); + +' +cat $FILES | grep '^void Test' | + sed -e 's/^void //' \ + -e 's/(.*$//' \ + -e 's/^/ SUITE_ADD_TEST(suite, /' \ + -e 's/$/);/' + +echo \ +' + CuSuiteRun(suite); + CuSuiteSummary(suite, output); + CuSuiteDetails(suite, output); + printf("%s\n", output->buffer); +} + +int main(void) +{ + RunAllTests(); +} +' |