libsheepy

C lib for handling text files, strings and json like data structure with an object oriented system
git clone https://spartatek.se/git/libsheepy.git
Log | Files | Refs | README | LICENSE

make-tests.sh (993B)


      1 #!/usr/bin/env bash
      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 
      9 if test $# -eq 0 ; then FILES=*.c ; else FILES=$* ; fi
     10 
     11 echo '
     12 
     13 /* This is auto-generated code. Edit at your own peril. */
     14 #include <stdio.h>
     15 #include <stdlib.h>
     16 
     17 #include "CuTest.h"
     18 
     19 '
     20 
     21 cat $FILES | grep '^void Test' | 
     22     sed -e 's/(.*$//' \
     23         -e 's/$/(CuTest*);/' \
     24         -e 's/^/extern /'
     25 
     26 echo \
     27 '
     28 
     29 void RunAllTests(void) 
     30 {
     31     CuString *output = CuStringNew();
     32     CuSuite* suite = CuSuiteNew();
     33 
     34 '
     35 cat $FILES | grep '^void Test' | 
     36     sed -e 's/^void //' \
     37         -e 's/(.*$//' \
     38         -e 's/^/    SUITE_ADD_TEST(suite, /' \
     39         -e 's/$/);/'
     40 
     41 echo \
     42 '
     43     CuSuiteRun(suite);
     44     CuSuiteSummary(suite, output);
     45     CuSuiteDetails(suite, output);
     46     printf("%s\n", output->buffer);
     47     CuStringDelete(output);
     48     CuSuiteDelete(suite);
     49 }
     50 
     51 int main(void)
     52 {
     53     RunAllTests();
     54 }
     55 '