source: trunk/src/make-tests.sh@ 18

Last change on this file since 18 was 17, checked in by katerina, 19 years ago

Optimized version of tiger algorithm, and basic ingredients for unit testing (part 1)

  • Property svn:executable set to *
File size: 923 bytes
Line 
1#!/bin/sh
2
3# Auto generate single AllTests file for CuTest.
4# Searches through all *.c files in the current directory.
5# Prints to stdout.
6# Author: Asim Jalis
7# Date: 01/08/2003
8
9if test $# -eq 0 ; then FILES=*.c ; else FILES=$* ; fi
10
11echo '
12
13/* This is auto-generated code. Edit at your own peril. */
14
15#include <stdio.h>
16#include "CuTest.h"
17
18'
19
20cat $FILES | grep '^void Test' |
21 sed -e 's/(.*$//' \
22 -e 's/$/(CuTest*);/' \
23 -e 's/^/extern /'
24
25echo \
26'
27
28void RunAllTests(void)
29{
30 CuString *output = CuStringNew();
31 CuSuite* suite = CuSuiteNew();
32
33'
34cat $FILES | grep '^void Test' |
35 sed -e 's/^void //' \
36 -e 's/(.*$//' \
37 -e 's/^/ SUITE_ADD_TEST(suite, /' \
38 -e 's/$/);/'
39
40echo \
41'
42 CuSuiteRun(suite);
43 CuSuiteSummary(suite, output);
44 CuSuiteDetails(suite, output);
45 printf("%s\n", output->buffer);
46}
47
48int main(void)
49{
50 RunAllTests();
51 return 0;
52}
53'
Note: See TracBrowser for help on using the repository browser.