1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-12-22 20:36:01 +01:00

Merge tests into single exe

This commit is contained in:
Anthony Scemama 2020-10-21 19:50:18 +02:00
parent 8c9a10cae6
commit 5f5465eaf9
6 changed files with 144 additions and 87 deletions

1
src/.gitignore vendored
View File

@ -4,3 +4,4 @@
*~ *~
*.so *.so
Makefile.generated Makefile.generated
test_qmckl

View File

@ -7,7 +7,7 @@ FFLAGS=-fcheck=all -Waliasing -Wampersand -Wconversion -Wsurprising -Wintrinsics
export CC CFLAGS FC FFLAGS export CC CFLAGS FC FFLAGS
ORG_SOURCE_FILES=$(wildcard qmckl*.org) ORG_SOURCE_FILES=$(wildcard qmckl*.org) test_qmckl.org
OBJECT_FILES=$(filter-out $(EXCLUDED_OBJECTS), $(patsubst %.org,%.o,$(ORG_SOURCE_FILES))) OBJECT_FILES=$(filter-out $(EXCLUDED_OBJECTS), $(patsubst %.org,%.o,$(ORG_SOURCE_FILES)))
.PHONY: clean .PHONY: clean

View File

@ -36,8 +36,8 @@ for i in $(ls qmckl_*.f90) ; do
done >> $OUTPUT done >> $OUTPUT
TESTS="" TESTS=""
for i in $(ls test_*.c) ; do for i in $(ls test_qmckl_*.c) ; do
FILE=${i%.c} FILE=${i}
TESTS="${TESTS} ${FILE}" TESTS="${TESTS} ${FILE}"
done >> $OUTPUT done >> $OUTPUT
@ -46,7 +46,7 @@ done >> $OUTPUT
cat << EOF > $OUTPUT cat << EOF > $OUTPUT
CC=$CC CC=$CC
CFLAGS=$CFLAGS CFLAGS=$CFLAGS -I../munit/
FC=$FC FC=$FC
FFLAGS=$FFLAGS FFLAGS=$FFLAGS
@ -62,12 +62,13 @@ libqmckl.so: \$(OBJECT_FILES)
%.o: %.f90 %.o: %.f90
\$(FC) \$(FFLAGS) -c \$*.f90 -o \$*.o \$(FC) \$(FFLAGS) -c \$*.f90 -o \$*.o
test_%: test_%.c test_qmckl: test_qmckl.c libqmckl.so \$(TESTS)
echo \$(TESTS)
\$(CC) \$(CFLAGS) -Wl,-rpath,$PWD -L. \ \$(CC) \$(CFLAGS) -Wl,-rpath,$PWD -L. \
-I../munit/ ../munit/munit.c test_\$*.c -lqmckl -o test_\$* ../munit/munit.c \$(TESTS) -lqmckl test_qmckl.c -o test_qmckl
test: libqmckl.so \$(TESTS) test: test_qmckl
for i in \$(TESTS) ; do ./\$\$i ; done ./test_qmckl
.PHONY: test .PHONY: test
EOF EOF
@ -82,4 +83,9 @@ for i in $(ls qmckl_*.f90) ; do
echo "${FILE}.o: ${FILE}.f90" echo "${FILE}.o: ${FILE}.f90"
done >> $OUTPUT done >> $OUTPUT
for i in $(ls test_qmckl_*.c) ; do
FILE=${i%.c}
echo "${FILE}.o: ${FILE}.c qmckl.h"
done >> $OUTPUT

View File

@ -11,22 +11,22 @@ C than in Fortran.
- a test file : =test_qmckl_context.c= - a test file : =test_qmckl_context.c=
*** Header *** Header
#+BEGIN_SRC C :tangle qmckl_context.h #+BEGIN_SRC C :comments link :tangle qmckl_context.h
#ifndef QMCKL_CONTEXT_H #ifndef QMCKL_CONTEXT_H
#define QMCKL_CONTEXT_H #define QMCKL_CONTEXT_H
#include "qmckl.h" #include "qmckl.h"
#+END_SRC #+END_SRC
*** Source *** Source
#+BEGIN_SRC C :tangle qmckl_context.c #+BEGIN_SRC C :comments link :tangle qmckl_context.c
#include "qmckl.h" #include "qmckl.h"
#+END_SRC #+END_SRC
*** Test *** Test
#+BEGIN_SRC C :tangle test_qmckl_context.c #+BEGIN_SRC C :comments link :tangle test_qmckl_context.c
#include "qmckl.h" #include "qmckl.h"
#include "munit.h" #include "munit.h"
static MunitResult test_qmckl_context() { MunitResult test_qmckl_context() {
#+END_SRC #+END_SRC
* Context * Context
@ -39,13 +39,13 @@ static MunitResult test_qmckl_context() {
A value of 0 for the context is equivalent to a NULL pointer. A value of 0 for the context is equivalent to a NULL pointer.
*** Header *** Header
#+BEGIN_SRC C :tangle qmckl_context.h #+BEGIN_SRC C :comments link :tangle qmckl_context.h
/* 64-bit integer */ /* 64-bit integer */
typedef long long int qmckl_context ; typedef long long int qmckl_context ;
#+END_SRC #+END_SRC
*** Source *** Source
#+BEGIN_SRC C :tangle qmckl_context.c #+BEGIN_SRC C :comments link :tangle qmckl_context.c
typedef struct qmckl_context_struct { typedef struct qmckl_context_struct {
struct qmckl_context_struct * prev; struct qmckl_context_struct * prev;
unsigned int tag; unsigned int tag;
@ -62,7 +62,7 @@ typedef struct qmckl_context_struct {
*** Test *** Test
We declare here the variables used in the tests. We declare here the variables used in the tests.
#+BEGIN_SRC C :tangle test_qmckl_context.c #+BEGIN_SRC C :comments link :tangle test_qmckl_context.c
qmckl_context context; qmckl_context context;
qmckl_context new_context; qmckl_context new_context;
#+END_SRC #+END_SRC
@ -74,12 +74,12 @@ typedef struct qmckl_context_struct {
Returns the input =qmckl_context= if the context is valid, 0 otherwise. Returns the input =qmckl_context= if the context is valid, 0 otherwise.
*** Header *** Header
#+BEGIN_SRC C :tangle qmckl_context.h #+BEGIN_SRC C :comments link :tangle qmckl_context.h
qmckl_context qmckl_context_check(qmckl_context context) ; qmckl_context qmckl_context_check(qmckl_context context) ;
#+END_SRC #+END_SRC
*** Source *** Source
#+BEGIN_SRC C :tangle qmckl_context.c #+BEGIN_SRC C :comments link :tangle qmckl_context.c
qmckl_context qmckl_context_check(qmckl_context context) { qmckl_context qmckl_context_check(qmckl_context context) {
qmckl_context_struct * ctx; qmckl_context_struct * ctx;
@ -99,12 +99,12 @@ qmckl_context qmckl_context_check(qmckl_context context) {
- Returns 0 upon failure to allocate the internal data structure - Returns 0 upon failure to allocate the internal data structure
*** Header *** Header
#+BEGIN_SRC C :tangle qmckl_context.h #+BEGIN_SRC C :comments link :tangle qmckl_context.h
qmckl_context qmckl_context_create(); qmckl_context qmckl_context_create();
#+END_SRC #+END_SRC
*** Source *** Source
#+BEGIN_SRC C :tangle qmckl_context.c #+BEGIN_SRC C :comments link :tangle qmckl_context.c
qmckl_context qmckl_context_create() { qmckl_context qmckl_context_create() {
qmckl_context_struct* context; qmckl_context_struct* context;
@ -124,7 +124,7 @@ qmckl_context qmckl_context_create() {
#+END_SRC #+END_SRC
*** Test *** Test
#+BEGIN_SRC C :tangle test_qmckl_context.c #+BEGIN_SRC C :comments link :tangle test_qmckl_context.c
context = qmckl_context_create(); context = qmckl_context_create();
munit_assert_long( context, !=, (qmckl_context) 0); munit_assert_long( context, !=, (qmckl_context) 0);
munit_assert_long( qmckl_context_check(context), ==, context); munit_assert_long( qmckl_context_check(context), ==, context);
@ -139,12 +139,12 @@ qmckl_context qmckl_context_create() {
for the new context for the new context
*** Header *** Header
#+BEGIN_SRC C :tangle qmckl_context.h #+BEGIN_SRC C :comments link :tangle qmckl_context.h
qmckl_context qmckl_context_copy(const qmckl_context context); qmckl_context qmckl_context_copy(const qmckl_context context);
#+END_SRC #+END_SRC
*** Source *** Source
#+BEGIN_SRC C :tangle qmckl_context.c #+BEGIN_SRC C :comments link :tangle qmckl_context.c
qmckl_context qmckl_context_copy(const qmckl_context context) { qmckl_context qmckl_context_copy(const qmckl_context context) {
qmckl_context_struct* old_context; qmckl_context_struct* old_context;
@ -175,7 +175,7 @@ qmckl_context qmckl_context_copy(const qmckl_context context) {
#+END_SRC #+END_SRC
*** Test *** Test
#+BEGIN_SRC C :tangle test_qmckl_context.c #+BEGIN_SRC C :comments link :tangle test_qmckl_context.c
new_context = qmckl_context_copy(context); new_context = qmckl_context_copy(context);
munit_assert_long(new_context, !=, (qmckl_context) 0); munit_assert_long(new_context, !=, (qmckl_context) 0);
munit_assert_long(new_context, !=, context); munit_assert_long(new_context, !=, context);
@ -190,12 +190,12 @@ qmckl_context qmckl_context_copy(const qmckl_context context) {
- Returns 0 for the 0-valued context - Returns 0 for the 0-valued context
*** Header *** Header
#+BEGIN_SRC C :tangle qmckl_context.h #+BEGIN_SRC C :comments link :tangle qmckl_context.h
qmckl_context qmckl_context_previous(const qmckl_context context); qmckl_context qmckl_context_previous(const qmckl_context context);
#+END_SRC #+END_SRC
*** Source *** Source
#+BEGIN_SRC C :tangle qmckl_context.c #+BEGIN_SRC C :comments link :tangle qmckl_context.c
qmckl_context qmckl_context_previous(const qmckl_context context) { qmckl_context qmckl_context_previous(const qmckl_context context) {
qmckl_context checked_context; qmckl_context checked_context;
@ -212,7 +212,7 @@ qmckl_context qmckl_context_previous(const qmckl_context context) {
#+END_SRC #+END_SRC
*** Test *** Test
#+BEGIN_SRC C :tangle test_qmckl_context.c #+BEGIN_SRC C :comments link :tangle test_qmckl_context.c
munit_assert_long(qmckl_context_previous(new_context), !=, (qmckl_context) 0); munit_assert_long(qmckl_context_previous(new_context), !=, (qmckl_context) 0);
munit_assert_long(qmckl_context_previous(new_context), ==, context); munit_assert_long(qmckl_context_previous(new_context), ==, context);
munit_assert_long(qmckl_context_previous(context), ==, (qmckl_context) 0); munit_assert_long(qmckl_context_previous(context), ==, (qmckl_context) 0);
@ -228,12 +228,12 @@ qmckl_context qmckl_context_previous(const qmckl_context context) {
- Fails if the the pointer is not a valid context - Fails if the the pointer is not a valid context
*** Header *** Header
#+BEGIN_SRC C :tangle qmckl_context.h #+BEGIN_SRC C :comments link :tangle qmckl_context.h
qmckl_exit_code qmckl_context_destroy(qmckl_context context); qmckl_exit_code qmckl_context_destroy(qmckl_context context);
#+END_SRC #+END_SRC
*** Source *** Source
#+BEGIN_SRC C :tangle qmckl_context.c #+BEGIN_SRC C :comments link :tangle qmckl_context.c
qmckl_exit_code qmckl_context_destroy(qmckl_context context) { qmckl_exit_code qmckl_context_destroy(qmckl_context context) {
qmckl_context_struct* ctx; qmckl_context_struct* ctx;
@ -252,7 +252,7 @@ qmckl_exit_code qmckl_context_destroy(qmckl_context context) {
#+END_SRC #+END_SRC
*** Test *** Test
#+BEGIN_SRC C :tangle test_qmckl_context.c #+BEGIN_SRC C :comments link :tangle test_qmckl_context.c
munit_assert_long(qmckl_context_check(new_context), ==, new_context); munit_assert_long(qmckl_context_check(new_context), ==, new_context);
munit_assert_long(new_context, !=, (qmckl_context) 0); munit_assert_long(new_context, !=, (qmckl_context) 0);
munit_assert_int(qmckl_context_destroy(new_context), ==, QMCKL_SUCCESS); munit_assert_int(qmckl_context_destroy(new_context), ==, QMCKL_SUCCESS);
@ -274,11 +274,11 @@ qmckl_exit_code qmckl_context_destroy(qmckl_context context) {
** =qmckl_context_update_precision= ** =qmckl_context_update_precision=
#+BEGIN_SRC C :tangle qmckl_context.h #+BEGIN_SRC C :comments link :tangle qmckl_context.h
qmckl_exit_code qmckl_context_update_precision(const qmckl_context context, int precision); qmckl_exit_code qmckl_context_update_precision(const qmckl_context context, int precision);
#+END_SRC #+END_SRC
#+BEGIN_SRC C :tangle qmckl_context.c #+BEGIN_SRC C :comments link :tangle qmckl_context.c
qmckl_exit_code qmckl_context_update_precision(const qmckl_context context, int precision) { qmckl_exit_code qmckl_context_update_precision(const qmckl_context context, int precision) {
qmckl_context_struct* ctx; qmckl_context_struct* ctx;
@ -294,11 +294,11 @@ qmckl_exit_code qmckl_context_update_precision(const qmckl_context context, int
#+END_SRC #+END_SRC
** =qmckl_context_update_range= ** =qmckl_context_update_range=
#+BEGIN_SRC C :tangle qmckl_context.h #+BEGIN_SRC C :comments link :tangle qmckl_context.h
qmckl_exit_code qmckl_context_update_range(const qmckl_context context, int range); qmckl_exit_code qmckl_context_update_range(const qmckl_context context, int range);
#+END_SRC #+END_SRC
#+BEGIN_SRC C :tangle qmckl_context.c #+BEGIN_SRC C :comments link :tangle qmckl_context.c
qmckl_exit_code qmckl_context_update_range(const qmckl_context context, int range) { qmckl_exit_code qmckl_context_update_range(const qmckl_context context, int range) {
qmckl_context_struct* ctx; qmckl_context_struct* ctx;
@ -317,11 +317,11 @@ qmckl_exit_code qmckl_context_update_range(const qmckl_context context, int rang
** =qmckl_context_set_precision= ** =qmckl_context_set_precision=
#+BEGIN_SRC C :tangle qmckl_context.h #+BEGIN_SRC C :comments link :tangle qmckl_context.h
qmckl_context qmckl_context_set_precision(const qmckl_context context, int precision); qmckl_context qmckl_context_set_precision(const qmckl_context context, int precision);
#+END_SRC #+END_SRC
#+BEGIN_SRC C :tangle qmckl_context.c #+BEGIN_SRC C :comments link :tangle qmckl_context.c
qmckl_context qmckl_context_set_precision(const qmckl_context context, const int precision) { qmckl_context qmckl_context_set_precision(const qmckl_context context, const int precision) {
qmckl_context new_context; qmckl_context new_context;
@ -335,11 +335,11 @@ qmckl_context qmckl_context_set_precision(const qmckl_context context, const int
#+END_SRC #+END_SRC
** =qmckl_context_set_range= ** =qmckl_context_set_range=
#+BEGIN_SRC C :tangle qmckl_context.h #+BEGIN_SRC C :comments link :tangle qmckl_context.h
qmckl_context qmckl_context_set_range(const qmckl_context context, int range); qmckl_context qmckl_context_set_range(const qmckl_context context, int range);
#+END_SRC #+END_SRC
#+BEGIN_SRC C :tangle qmckl_context.c #+BEGIN_SRC C :comments link :tangle qmckl_context.c
qmckl_context qmckl_context_set_range(const qmckl_context context, int range) { qmckl_context qmckl_context_set_range(const qmckl_context context, int range) {
qmckl_context new_context; qmckl_context new_context;
@ -356,11 +356,11 @@ qmckl_context qmckl_context_set_range(const qmckl_context context, int range) {
** =qmckl_context_get_precision= ** =qmckl_context_get_precision=
#+BEGIN_SRC C :tangle qmckl_context.h #+BEGIN_SRC C :comments link :tangle qmckl_context.h
int qmckl_context_get_precision(const qmckl_context context); int qmckl_context_get_precision(const qmckl_context context);
#+END_SRC #+END_SRC
#+BEGIN_SRC C :tangle qmckl_context.c #+BEGIN_SRC C :comments link :tangle qmckl_context.c
int qmckl_context_get_precision(const qmckl_context context) { int qmckl_context_get_precision(const qmckl_context context) {
qmckl_context_struct* ctx; qmckl_context_struct* ctx;
ctx = (qmckl_context_struct*) context; ctx = (qmckl_context_struct*) context;
@ -370,11 +370,11 @@ int qmckl_context_get_precision(const qmckl_context context) {
** =qmckl_context_get_range= ** =qmckl_context_get_range=
#+BEGIN_SRC C :tangle qmckl_context.h #+BEGIN_SRC C :comments link :tangle qmckl_context.h
int qmckl_context_get_range(const qmckl_context context); int qmckl_context_get_range(const qmckl_context context);
#+END_SRC #+END_SRC
#+BEGIN_SRC C :tangle qmckl_context.c #+BEGIN_SRC C :comments link :tangle qmckl_context.c
int qmckl_context_get_range(const qmckl_context context) { int qmckl_context_get_range(const qmckl_context context) {
qmckl_context_struct* ctx; qmckl_context_struct* ctx;
ctx = (qmckl_context_struct*) context; ctx = (qmckl_context_struct*) context;
@ -387,28 +387,13 @@ int qmckl_context_get_range(const qmckl_context context) {
* End of files * End of files
*** Header *** Header
#+BEGIN_SRC C :tangle qmckl_context.h #+BEGIN_SRC C :comments link :tangle qmckl_context.h
#endif #endif
#+END_SRC #+END_SRC
*** Test *** Test
#+BEGIN_SRC C :tangle test_qmckl_context.c #+BEGIN_SRC C :comments link :tangle test_qmckl_context.c
return MUNIT_OK; return MUNIT_OK;
} }
int main(int argc, char* argv[MUNIT_ARRAY_PARAM(argc + 1)]) {
static MunitTest test_suite_tests[] =
{
{ (char*) "qmckl_context", test_qmckl_context, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL },
{ NULL, NULL, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL }
};
static const MunitSuite test_suite =
{
(char*) "", test_suite_tests, NULL, 1, MUNIT_SUITE_OPTION_NONE
};
return munit_suite_main(&test_suite, (void*) "µnit", argc, argv);
}
#+END_SRC #+END_SRC

View File

@ -11,34 +11,34 @@ optimized libraries to fine-tune the memory allocation.
- a test file : =test_qmckl_memory.c= - a test file : =test_qmckl_memory.c=
*** Header *** Header
#+BEGIN_SRC C :tangle qmckl_memory.h #+BEGIN_SRC C :comments link :tangle qmckl_memory.h
#ifndef QMCKL_MEMORY_H #ifndef QMCKL_MEMORY_H
#define QMCKL_MEMORY_H #define QMCKL_MEMORY_H
#include "qmckl.h" #include "qmckl.h"
#+END_SRC #+END_SRC
*** Source *** Source
#+BEGIN_SRC C :tangle qmckl_memory.c #+BEGIN_SRC C :comments link :tangle qmckl_memory.c
#include <stdlib.h> #include <stdlib.h>
#include "qmckl_memory.h" #include "qmckl_memory.h"
#+END_SRC #+END_SRC
*** Test *** Test
#+BEGIN_SRC C :tangle test_qmckl_memory.c #+BEGIN_SRC C :comments link :tangle test_qmckl_memory.c
#include "qmckl.h" #include "qmckl.h"
#include "munit.h" #include "munit.h"
static MunitResult test_qmckl_memory() { MunitResult test_qmckl_memory() {
#+END_SRC #+END_SRC
** =qmckl_malloc= ** =qmckl_malloc=
Analogous of =malloc, but passing signed 64-bit integers as argument.= Analogous of =malloc, but passing signed 64-bit integers as argument.=
*** Header *** Header
#+BEGIN_SRC C :tangle qmckl_memory.h #+BEGIN_SRC C :comments link :tangle qmckl_memory.h
void* qmckl_malloc(long long int size); void* qmckl_malloc(long long int size);
#+END_SRC #+END_SRC
*** Source *** Source
#+BEGIN_SRC C :tangle qmckl_memory.c #+BEGIN_SRC C :comments link :tangle qmckl_memory.c
void* qmckl_malloc(long long int size) { void* qmckl_malloc(long long int size) {
return malloc( (size_t) size ); return malloc( (size_t) size );
} }
@ -46,7 +46,7 @@ void* qmckl_malloc(long long int size) {
#+END_SRC #+END_SRC
*** Test *** Test
#+BEGIN_SRC C :tangle test_qmckl_memory.c #+BEGIN_SRC C :comments link :tangle test_qmckl_memory.c
int *a; int *a;
a = (int*) qmckl_malloc(3*sizeof(int)); a = (int*) qmckl_malloc(3*sizeof(int));
a[0] = 1; a[0] = 1;
@ -60,46 +60,32 @@ void* qmckl_malloc(long long int size) {
** =qmckl_free= ** =qmckl_free=
*** Header *** Header
#+BEGIN_SRC C :tangle qmckl_memory.h #+BEGIN_SRC C :comments link :tangle qmckl_memory.h
void qmckl_free(void *ptr); void qmckl_free(void *ptr);
#+END_SRC #+END_SRC
*** Source *** Source
#+BEGIN_SRC C :tangle qmckl_memory.c #+BEGIN_SRC C :comments link :tangle qmckl_memory.c
void qmckl_free(void *ptr) { void qmckl_free(void *ptr) {
free(ptr); free(ptr);
} }
#+END_SRC #+END_SRC
*** Test *** Test
#+BEGIN_SRC C :tangle test_qmckl_memory.c #+BEGIN_SRC C :comments link :tangle test_qmckl_memory.c
qmckl_free(a); qmckl_free(a);
#+END_SRC #+END_SRC
* End of files * End of files
*** Header *** Header
#+BEGIN_SRC C :tangle qmckl_memory.h #+BEGIN_SRC C :comments link :tangle qmckl_memory.h
#endif #endif
#+END_SRC #+END_SRC
*** Test *** Test
#+BEGIN_SRC C :tangle test_qmckl_memory.c #+BEGIN_SRC C :comments link :tangle test_qmckl_memory.c
return MUNIT_OK; return MUNIT_OK;
} }
int main(int argc, char* argv[MUNIT_ARRAY_PARAM(argc + 1)]) {
static MunitTest test_suite_tests[] =
{
{ (char*) "qmckl_memory", test_qmckl_memory, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL },
{ NULL, NULL, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL }
};
static const MunitSuite test_suite =
{
(char*) "", test_suite_tests, NULL, 1, MUNIT_SUITE_OPTION_NONE
};
return munit_suite_main(&test_suite, (void*) "µnit", argc, argv);
}
#+END_SRC #+END_SRC

79
src/test_qmckl.org Normal file
View File

@ -0,0 +1,79 @@
#+TITLE: QMCkl test
This file is the main program of the unit tests. The tests rely on the
$\mu$unit framework, which is provided as a git submodule.
First, we use a script to find the list of all the produced test files:
#+NAME: test-files
#+BEGIN_SRC sh :exports none :results value
grep BEGIN_SRC *.org | \
grep test_qmckl_ | \
rev | \
cut -d ' ' -f 1 | \
rev | \
sort | \
uniq
#+END_SRC
#+RESULTS: test-files
| test_qmckl_context.c |
| test_qmckl_memory.c |
We generate the function headers
#+BEGIN_SRC sh :var files=test-files :exports output :results raw
echo "#+NAME: headers"
echo "#+BEGIN_SRC C :tangle no"
for file in $files
do
routine=${file%.c}
echo "MunitResult ${routine}();"
done
echo "#+END_SRC"
#+END_SRC
#+RESULTS:
#+NAME: headers
#+BEGIN_SRC C :tangle no
MunitResult test_qmckl_context();
MunitResult test_qmckl_memory();
#+END_SRC
and the required function calls:
#+BEGIN_SRC sh :var files=test-files :exports output :results raw
echo "#+NAME: calls"
echo "#+BEGIN_SRC C :tangle no"
for file in $files
do
routine=${file%.c}
echo " { (char*) \"${routine}\", ${routine}, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL},"
done
echo "#+END_SRC"
#+END_SRC
#+RESULTS:
#+NAME: calls
#+BEGIN_SRC C :tangle no
{ (char*) "test_qmckl_context", test_qmckl_context, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL},
{ (char*) "test_qmckl_memory", test_qmckl_memory, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL},
#+END_SRC
#+BEGIN_SRC C :comments link :noweb yes :tangle test_qmckl.c
#include "qmckl.h"
#include "munit.h"
<<headers>>
int main(int argc, char* argv[MUNIT_ARRAY_PARAM(argc + 1)]) {
static MunitTest test_suite_tests[] =
{
<<calls>>
{ NULL, NULL, NULL, NULL, MUNIT_TEST_OPTION_NONE, NULL }
};
static const MunitSuite test_suite =
{
(char*) "", test_suite_tests, NULL, 1, MUNIT_SUITE_OPTION_NONE
};
return munit_suite_main(&test_suite, (void*) "µnit", argc, argv);
}
#+END_SRC