Just an exercise implementing the algorithms from 《数值计算方法》,林成森,科学出版社, do not guarantee the programs run perfectly.
- make
- gcc(>= c99)
- sed(for makefile dependencies)
- python
Myrecipes
|-- include: header files
|-- test: test files
| |-- Test.c
| |-- Test.h
| |-- GenerateTest.py
| +-- test*.c
|-- [A-Z]*: source files
|-- (created) debug: intermediate files
+-- (created) lib: static library files
-
Test files follows the pattern in order to automatically parse and generate a test header file:
- All the test functions are written in
test*.c
files. - Every test function must return
int
type, have no argumemts and be named astest*
.
- All the test functions are written in
-
GenerateTest.py
is a python script that scans throughtest*.c
files, looks for functions that meet the conditions mentioned above and generate a header fileTest.h
which contains declarations, (macro)list of function variables, (macro)list of function names and (macro)the number of all the test functions. -
Test.c
is a short C file that includesTest.h
, uses the macros in it to call every test function and print the summary infomation of the test.
To show the flow in a chart:
GenerateTest.py
test*.c -----------------> Test.h \
|---> test binary
Test.c /