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

Removed need for munit

This commit is contained in:
Anthony Scemama 2021-05-11 16:41:03 +02:00
parent d4711206f0
commit ee9e3c5b55
17 changed files with 304 additions and 334 deletions

9
.gitignore vendored
View File

@ -5,12 +5,12 @@ generated.mk
stamp-h1
libtool
ltmain.sh
missing
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
missing
Makefile
aclocal.m4
autom4te.cache/
@ -21,4 +21,9 @@ config.sub
configure
install-sh
qmckl.pc
Makefile.in
test-driver
.libs
.dirstamp
*.la
*.lo

3
.gitmodules vendored
View File

@ -1,3 +0,0 @@
[submodule "munit"]
path = munit
url = https://github.com/nemequ/munit/

View File

@ -38,7 +38,7 @@ VERSION_MINOR = @VERSION_MINOR@
VERSION_PATCH = @VERSION_PATCH@
SUBDIRS =
CLEANFILES =
CLEANFILES =
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = $(srcdir)/qmckl.pc
@ -46,60 +46,39 @@ pkgconfig_DATA = $(srcdir)/qmckl.pc
qmckl_h = $(srcdir)/include/qmckl.h
include_HEADERS = $(qmckl_h)
qmckl_f = $(srcdir)/share/qmckl/fortran/qmckl_f.f90
qmckl_f = $(srcdir)/share/qmckl/fortran/qmckl_f.f90
qmckl_fo = $(srcdir)/share/qmckl/fortran/qmckl_f.$(OBJEXT)
test_qmckl_f = $(srcdir)/tests/qmckl_f.f90
src_qmckl_f = $(srcdir)/src/qmckl_f.f90
fortrandir = $(datadir)/$(PACKAGE_NAME)/fortran/
fortran_DATA = $(qmckl_f)
lib_LTLIBRARIES = src/libqmckl.la
src_libqmckl_la_CPPFLAGS = -I$(srcdir)/src -I$(srcdir)/include
src_libqmckl_la_SOURCES = $(qmckl_h) $(qmckl_f) $(C_FILES) $(F_FILES) $(H_PRIVATE_FUNC_FILES) $(H_PRIVATE_TYPE_FILES)
AM_CPPFLAGS = -I$(srcdir)/src -I$(srcdir)/include
lib_LTLIBRARIES = src/libqmckl.la
src_libqmckl_la_SOURCES = $(qmckl_h) $(src_qmckl_f) $(C_FILES) $(F_FILES) $(H_PRIVATE_FUNC_FILES) $(H_PRIVATE_TYPE_FILES)
export srcdir qmckl_f qmckl_h
CLEANFILES+=$(test_qmckl_f)
if QMCKL_DEVEL
# <-----
dist_src_DATA = $(ORG_FILES)
BUILT_SOURCES = $(C_FILES) $(F_FILES) $(FH_FUNC_FILES) $(FH_TYPE_FILES) $(H_FUNC_FILES) $(H_TYPE_FILES) $(H_PRIVATE_FUNC_FILES) $(H_PRIVATE_TYPE_FILES)
CLEANFILES += $(BUILT_SOURCES) $(C_TEST_FILES) $(F_TEST_FILES) $(TANGLED_FILES) $(C_TEST_FILES) $(F_TEST_FILES)
# ----->
endif
## Silent
tangle_verbose = $(tangle_verbose_@AM_V@)
tangle_verbose_ = $(tangle_verbose_@AM_DEFAULT_V@)
tangle_verbose_0 = @echo " TANGLE $<";
cat_h_verbose = $(cat_h_verbose_@AM_V@)
cat_h_verbose_ = $(cat_h_verbose_@AM_DEFAULT_V@)
cat_h_verbose_0 = @echo " HEADER $@";
## Rules
include $(srcdir)/generated.mk
SUFFIXES = .f90 .h .org .c _f.f90 _func.h _type.h _private_func.h _private_type.h
if QMCKL_DEVEL
include Makefile.dev.mk
else
include Makefile.dist.mk
endif
$(srcdir)/generated.mk: $(ORG_FILES)
$(srcdir)/tools/build_makefile.sh
$(qmckl_h): $(H_FUNC_FILES) $(H_TYPE_FILES)
$(cat_h_verbose)$(srcdir)/tools/build_qmckl_h.sh
$(test_qmckl_f): $(qmckl_f)
cp $(qmckl_f) $(test_qmckl_f)
$(qmckl_f): $(FH_FUNC_FILES) $(FH_TYPE_FILES)
$(cat_h_verbose)$(srcdir)/tools/build_qmckl_f.sh
$(srcdir)/src/qmckl_f.f90: $(qmckl_f)
cp $(qmckl_f) $(srcdir)/src/qmckl_f.f90
#lib_LTLIBRARIES = $(top_srcdir)/src/libqmckl.la
#
#$(top_srcdir)/src/libqmckl.la;
# $(MAKE) -C src libqmckl.la
#
$(src_qmckl_f): $(qmckl_f)
cp $(qmckl_f) $(src_qmckl_f)
rpms srcrpm:
for dir in $(SUBDIRS); do \

63
Makefile.dev.mk Normal file
View File

@ -0,0 +1,63 @@
# QMCkl - Quantum Monte Carlo kernel library
#
# BSD 3-Clause License
#
# Copyright (c) 2020, TREX Center of Excellence
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
dist_src_DATA = $(ORG_FILES)
BUILT_SOURCES = $(C_FILES) $(F_FILES) $(FH_FUNC_FILES) $(FH_TYPE_FILES) $(H_FUNC_FILES) $(H_TYPE_FILES) $(H_PRIVATE_FUNC_FILES) $(H_PRIVATE_TYPE_FILES) $(qmckl_f) $(qmckl_h)
CLEANFILES += $(BUILT_SOURCES) $(C_TEST_FILES) $(F_TEST_FILES) $(TANGLED_FILES) $(C_TEST_FILES) $(F_TEST_FILES) $(qmckl_f) $(qmckl_h)
## Silent
## ======
tangle_verbose = $(tangle_verbose_@AM_V@)
tangle_verbose_ = $(tangle_verbose_@AM_DEFAULT_V@)
tangle_verbose_0 = @echo " TANGLE $<";
cat_h_verbose = $(cat_h_verbose_@AM_V@)
cat_h_verbose_ = $(cat_h_verbose_@AM_DEFAULT_V@)
cat_h_verbose_0 = @echo " HEADER $@";
## Rules
## =====
SUFFIXES = .f90 .h .org .c _f.f90 _func.h _type.h _private_func.h _private_type.h
$(qmckl_h): $(H_FUNC_FILES) $(H_TYPE_FILES)
$(cat_h_verbose)$(srcdir)/tools/build_qmckl_h.sh
$(qmckl_f): $(FH_FUNC_FILES) $(FH_TYPE_FILES)
$(cat_h_verbose)$(srcdir)/tools/build_qmckl_f.sh
# vim: syntax=automake noet

34
Makefile.dist.mk Normal file
View File

@ -0,0 +1,34 @@
# QMCkl - Quantum Monte Carlo kernel library
#
# BSD 3-Clause License
#
# Copyright (c) 2020, TREX Center of Excellence
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# 3. Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# vim: syntax=automake noet

View File

@ -15,11 +15,8 @@ to read the documentation.
To clone the repository, use:
```
git clone --recursive https://github.com/TREX-CoE/qmckl.git
git clone https://github.com/TREX-CoE/qmckl.git
```
to dowload also the [munit](https://github.com/nemequ/munit) unit testing
framework.
# Installation

View File

@ -193,29 +193,6 @@ if test "x${QMCKL_DEVEL}" != "x"; then
HAS_CPPCHECK=1
fi
## munit
AC_ARG_WITH(munit, [AC_HELP_STRING([--without-munit],[use munit for testing])], ok=yes, ok=no)
if test "$ok" = "no"; then
AC_CHECK_FILE([munit/munit.h], [],
AC_MSG_ERROR([
-------------------------------------------------
Error: Git submodule for munit is not downloaded.
$ git submodule update --init
-------------------------------------------------
]) )
else
ARGS="${ARGS} munit"
AC_DEFINE(HAVE_MUNIT,1,[Define when using munit])
fi
AC_CHECK_HEADERS([fcntl.h langinfo.h limits.h locale.h mach/mach.h sys/time.h])
AC_TYPE_PID_T
AC_C_INLINE
AC_TYPE_SSIZE_T
AC_FUNC_REALLOC
AC_FUNC_STRERROR_R
AC_FUNC_FORK
AC_CHECK_FUNCS([clock_gettime dup2 gettimeofday nl_langinfo setlocale strcasecmp strtoul])
fi
#PKG-CONFIG

View File

@ -12,37 +12,15 @@
/* Define to 1 if you have the <assert.h> header file. */
#undef HAVE_ASSERT_H
/* Define to 1 if you have the `clock_gettime' function. */
#undef HAVE_CLOCK_GETTIME
/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you
don't. */
#undef HAVE_DECL_STRERROR_R
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the `dup2' function. */
#undef HAVE_DUP2
/* Define to 1 if you have the <errno.h> header file. */
#undef HAVE_ERRNO_H
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define to 1 if you have the `fork' function. */
#undef HAVE_FORK
/* Define to 1 if you have the `gettimeofday' function. */
#undef HAVE_GETTIMEOFDAY
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <langinfo.h> header file. */
#undef HAVE_LANGINFO_H
/* Define to 1 if you have the `efence' library (-lefence). */
#undef HAVE_LIBEFENCE
@ -52,15 +30,6 @@
/* Define to 1 if you have the `pthread' library (-lpthread). */
#undef HAVE_LIBPTHREAD
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define to 1 if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define to 1 if you have the <mach/mach.h> header file. */
#undef HAVE_MACH_MACH_H
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#undef HAVE_MALLOC
@ -77,22 +46,9 @@
/* Define to 1 if you have the `memset' function. */
#undef HAVE_MEMSET
/* Define when using munit */
#undef HAVE_MUNIT
/* Define to 1 if you have the `nl_langinfo' function. */
#undef HAVE_NL_LANGINFO
/* Define to 1 if you have the <pthread.h> header file. */
#undef HAVE_PTHREAD_H
/* Define to 1 if your system has a GNU libc compatible `realloc' function,
and to 0 otherwise. */
#undef HAVE_REALLOC
/* Define to 1 if you have the `setlocale' function. */
#undef HAVE_SETLOCALE
/* Define to 1 if you have the <stdbool.h> header file. */
#undef HAVE_STDBOOL_H
@ -105,48 +61,24 @@
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `strcasecmp' function. */
#undef HAVE_STRCASECMP
/* Define to 1 if you have the `strerror' function. */
#undef HAVE_STRERROR
/* Define to 1 if you have the `strerror_r' function. */
#undef HAVE_STRERROR_R
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strtoul' function. */
#undef HAVE_STRTOUL
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the `vfork' function. */
#undef HAVE_VFORK
/* Define to 1 if you have the <vfork.h> header file. */
#undef HAVE_VFORK_H
/* Define to 1 if `fork' works. */
#undef HAVE_WORKING_FORK
/* Define to 1 if `vfork' works. */
#undef HAVE_WORKING_VFORK
/* Define to 1 if the system has the type `_Bool'. */
#undef HAVE__BOOL
@ -192,9 +124,6 @@
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to 1 if strerror_r returns char *. */
#undef STRERROR_R_CHAR_P
/* Version number of package */
#undef VERSION
@ -208,12 +137,6 @@
#define below would cause a syntax error. */
#undef _UINT64_T
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#undef inline
#endif
/* Define to the type of a signed integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
#undef int32_t
@ -225,18 +148,9 @@
/* Define to rpl_malloc if the replacement function should be used. */
#undef malloc
/* Define to `int' if <sys/types.h> does not define. */
#undef pid_t
/* Define to rpl_realloc if the replacement function should be used. */
#undef realloc
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
/* Define to `int' if <sys/types.h> does not define. */
#undef ssize_t
/* Define to the type of an unsigned integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
#undef uint32_t
@ -244,6 +158,3 @@
/* Define to the type of an unsigned integer type of width exactly 64 bits if
such a type exists and the standard includes do not define it. */
#undef uint64_t
/* Define as `fork' if `vfork' does not work. */
#undef vfork

View File

@ -48,14 +48,14 @@ gradients and Laplacian of the atomic basis functions.
#+begin_src c :tangle (eval c_test) :noweb yes
#include "qmckl.h"
#include "munit.h"
#include "assert.h"
#ifdef HAVE_CONFIG_H
#include <config.h>
#include "config.h"
#endif
MunitResult test_<<filename()>>() {
qmckl_context context;
context = qmckl_context_create();
int main() {
qmckl_context context;
context = qmckl_context_create();
#+end_src
#+begin_src c :tangle (eval c)
@ -795,85 +795,85 @@ qmckl_exit_code qmckl_set_ao_basis_coefficient(qmckl_context context, const dou
** Test :noexport:
#+begin_src c :tangle (eval c_test) :exports none :exports none
/* Reference input data */
/* Reference input data */
char typ = 'G';
#define shell_num ((int64_t) 12)
#define prim_num ((int64_t) 20)
char typ = 'G';
#define shell_num ((int64_t) 12)
#define prim_num ((int64_t) 20)
int64_t shell_center [shell_num] =
{ 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2 };
int64_t shell_center [shell_num] =
{ 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2 };
char shell_ang_mom [shell_num] =
{ 'S', 'S', 'S', 'P', 'P', 'D', 'S', 'S', 'S', 'P', 'P', 'D' };
char shell_ang_mom [shell_num] =
{ 'S', 'S', 'S', 'P', 'P', 'D', 'S', 'S', 'S', 'P', 'P', 'D' };
double shell_factor [shell_num] =
{ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1. };
double shell_factor [shell_num] =
{ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1. };
int64_t shell_prim_num [shell_num] =
{5, 1, 1, 1, 1, 1, 5, 1, 1, 1, 1, 1};
int64_t shell_prim_num [shell_num] =
{5, 1, 1, 1, 1, 1, 5, 1, 1, 1, 1, 1};
int64_t shell_prim_index [shell_num] =
{1, 6, 7, 8, 9, 10, 11, 16, 17, 18, 19, 20};
int64_t shell_prim_index [shell_num] =
{1, 6, 7, 8, 9, 10, 11, 16, 17, 18, 19, 20};
double exponent [prim_num] =
{ 33.87, 5.095, 1.159, 0.3258, 0.1027, 0.3258, 0.1027,
1.407, 0.388, 1.057, 33.87, 5.095, 1.159, 0.3258, 0.1027,
0.3258, 0.1027, 1.407, 0.388, 1.057 };
double exponent [prim_num] =
{ 33.87, 5.095, 1.159, 0.3258, 0.1027, 0.3258, 0.1027,
1.407, 0.388, 1.057, 33.87, 5.095, 1.159, 0.3258, 0.1027,
0.3258, 0.1027, 1.407, 0.388, 1.057 };
double coefficient [prim_num] =
{ 0.006068, 0.045308, 0.202822, 0.503903, 0.383421,
1.0, 1.0, 1.0, 1.0, 1.0, 0.006068, 0.045308, 0.202822,
0.503903, 0.383421, 1.0, 1.0, 1.0, 1.0, 1.0 };
/* --- */
double coefficient [prim_num] =
{ 0.006068, 0.045308, 0.202822, 0.503903, 0.383421,
1.0, 1.0, 1.0, 1.0, 1.0, 0.006068, 0.045308, 0.202822,
0.503903, 0.383421, 1.0, 1.0, 1.0, 1.0, 1.0 };
/* --- */
qmckl_exit_code rc;
qmckl_exit_code rc;
munit_assert(!qmckl_ao_basis_provided(context));
assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_type (context, typ);
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_type (context, typ);
assert(rc == QMCKL_SUCCESS);
assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_shell_num (context, shell_num);
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_shell_num (context, shell_num);
assert(rc == QMCKL_SUCCESS);
assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_prim_num (context, prim_num);
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_prim_num (context, prim_num);
assert(rc == QMCKL_SUCCESS);
assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_shell_center (context, shell_center);
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_shell_center (context, shell_center);
assert(rc == QMCKL_SUCCESS);
assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_shell_ang_mom (context, shell_ang_mom);
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_shell_ang_mom (context, shell_ang_mom);
assert(rc == QMCKL_SUCCESS);
assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_shell_factor (context, shell_factor);
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_shell_factor (context, shell_factor);
assert(rc == QMCKL_SUCCESS);
assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_shell_center (context, shell_prim_num);
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_shell_center (context, shell_prim_num);
assert(rc == QMCKL_SUCCESS);
assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_shell_prim_num (context, shell_prim_num);
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_shell_prim_num (context, shell_prim_num);
assert(rc == QMCKL_SUCCESS);
assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_shell_prim_index (context, shell_prim_index);
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_shell_prim_index (context, shell_prim_index);
assert(rc == QMCKL_SUCCESS);
assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_exponent (context, exponent);
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_exponent (context, exponent);
assert(rc == QMCKL_SUCCESS);
assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_coefficient (context, coefficient);
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert(qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_coefficient (context, coefficient);
assert(rc == QMCKL_SUCCESS);
assert(qmckl_ao_basis_provided(context));
#+end_src
@ -1070,8 +1070,8 @@ end function test_qmckl_ao_power
#+end_src
#+begin_src c :tangle (eval c_test) :exports none
int test_qmckl_ao_power(qmckl_context context);
munit_assert_int(0, ==, test_qmckl_ao_power(context));
int test_qmckl_ao_power(qmckl_context context);
assert(0 == test_qmckl_ao_power(context));
#+end_src
** Value, Gradient and Laplacian of a polynomial
@ -1446,8 +1446,8 @@ end function test_qmckl_ao_polynomial_vgl
#+end_src
#+begin_src c :tangle (eval c_test)
int test_qmckl_ao_polynomial_vgl(qmckl_context context);
munit_assert_int(0, ==, test_qmckl_ao_polynomial_vgl(context));
int test_qmckl_ao_polynomial_vgl(qmckl_context context);
assert(0 == test_qmckl_ao_polynomial_vgl(context));
#+end_src
* Radial part
@ -1656,8 +1656,8 @@ end function test_qmckl_ao_gaussian_vgl
#+end_src
#+begin_src c :tangle (eval c_test) :exports none
int test_qmckl_ao_gaussian_vgl(qmckl_context context);
munit_assert_int(0, ==, test_qmckl_ao_gaussian_vgl(context));
int test_qmckl_ao_gaussian_vgl(qmckl_context context);
assert(0 == test_qmckl_ao_gaussian_vgl(context));
#+end_src
** TODO Slater basis functions
@ -1672,9 +1672,10 @@ munit_assert_int(0, ==, test_qmckl_ao_gaussian_vgl(context));
*** Test
#+begin_src c :tangle (eval c_test)
if (qmckl_context_destroy(context) != QMCKL_SUCCESS)
return QMCKL_FAILURE;
return MUNIT_OK;
rc = qmckl_context_destroy(context);
assert (rc == QMCKL_SUCCESS);
return 0;
}
#+end_src

View File

@ -6,11 +6,11 @@
#+begin_src c :tangle (eval c_test) :noweb yes
#include "qmckl.h"
#include "munit.h"
#include "assert.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
MunitResult test_<<filename()>>() {
int main() {
#+end_src
#+begin_src c :tangle (eval h_private_type) :noweb yes
@ -253,11 +253,11 @@ qmckl_context qmckl_context_create() {
# Test
#+begin_src c :comments link :tangle (eval c_test) :exports none
munit_assert_int64( qmckl_context_check(QMCKL_NULL_CONTEXT), ==, QMCKL_NULL_CONTEXT);
assert( qmckl_context_check(QMCKL_NULL_CONTEXT) == QMCKL_NULL_CONTEXT);
qmckl_context context = qmckl_context_create();
munit_assert_int64( context, !=, QMCKL_NULL_CONTEXT );
munit_assert_int64( qmckl_context_check(context), ==, context );
assert( context != QMCKL_NULL_CONTEXT );
assert( qmckl_context_check(context) == context );
#+end_src
** Locking
@ -445,15 +445,15 @@ qmckl_exit_code qmckl_context_destroy(const qmckl_context context) {
# Test
#+begin_src c :tangle (eval c_test) :exports none
/* Destroy valid context */
munit_assert_int64(qmckl_context_check(context), ==, context);
munit_assert_int32(qmckl_context_destroy(context), ==, QMCKL_SUCCESS);
assert(qmckl_context_check(context) == context);
assert(qmckl_context_destroy(context) == QMCKL_SUCCESS);
/* Check that context is destroyed */
munit_assert_int64(qmckl_context_check(context), !=, context);
munit_assert_int64(qmckl_context_check(context), ==, QMCKL_NULL_CONTEXT);
assert(qmckl_context_check(context) != context);
assert(qmckl_context_check(context) == QMCKL_NULL_CONTEXT);
/* Destroy invalid context */
munit_assert_int32(qmckl_context_destroy(QMCKL_NULL_CONTEXT), ==, QMCKL_INVALID_CONTEXT);
assert(qmckl_context_destroy(QMCKL_NULL_CONTEXT) == QMCKL_INVALID_CONTEXT);
#+end_src
* End of files :noexport:
@ -465,7 +465,7 @@ munit_assert_int32(qmckl_context_destroy(QMCKL_NULL_CONTEXT), ==, QMCKL_INVALID_
*** Test
#+begin_src c :comments link :tangle (eval c_test)
return MUNIT_OK;
return 0;
}
#+end_src

View File

@ -11,11 +11,11 @@ Functions for the computation of distances between particles.
#+begin_src c :comments link :tangle (eval c_test) :noweb yes
#include "qmckl.h"
#include "munit.h"
#include "assert.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
MunitResult test_<<filename()>>() {
int main() {
qmckl_context context;
context = qmckl_context_create();
@ -393,7 +393,7 @@ end function test_qmckl_distance_sq
#+begin_src c :comments link :tangle (eval c_test)
int test_qmckl_distance_sq(qmckl_context context);
munit_assert_int(0, ==, test_qmckl_distance_sq(context));
assert(0 == test_qmckl_distance_sq(context));
#+end_src
* Distance
@ -771,14 +771,13 @@ end function test_qmckl_dist
#+begin_src c :comments link :tangle (eval c_test)
int test_qmckl_dist(qmckl_context context);
munit_assert_int(0, ==, test_qmckl_dist(context));
assert(0 == test_qmckl_dist(context));
#+end_src
* End of files :noexport:
#+begin_src c :comments link :tangle (eval c_test)
if (qmckl_context_destroy(context) != QMCKL_SUCCESS)
return QMCKL_FAILURE;
return MUNIT_OK;
assert (qmckl_context_destroy(context) == QMCKL_SUCCESS);
return 0;
}
#+end_src

View File

@ -20,11 +20,11 @@ up-spin and down-spin electrons, and the electron coordinates.
#+begin_src c :tangle (eval c_test) :noweb yes
#include "qmckl.h"
#include "munit.h"
#include "assert.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
MunitResult test_<<filename()>>() {
int main() {
qmckl_context context;
context = qmckl_context_create();
#+end_src
@ -399,18 +399,18 @@ double coord[walk_num*3*num] =
qmckl_exit_code rc;
munit_assert(!qmckl_electron_provided(context));
assert(!qmckl_electron_provided(context));
rc = qmckl_set_electron_num (context, up_num, down_num);
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert(!qmckl_electron_provided(context));
assert(rc == QMCKL_SUCCESS);
assert(!qmckl_electron_provided(context));
rc = qmckl_set_electron_walk_num (context, walk_num);
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert(qmckl_electron_provided(context));
assert(rc == QMCKL_SUCCESS);
assert(qmckl_electron_provided(context));
rc = qmckl_set_electron_coord (context, coord);
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
assert(rc == QMCKL_SUCCESS);
#+end_src
@ -603,14 +603,14 @@ end function qmckl_compute_ee_distance_f
#+begin_src c :tangle (eval c_test)
/* Reference input data */
munit_assert(qmckl_electron_provided(context));
assert(qmckl_electron_provided(context));
double distance[walk_num*num*num];
rc = qmckl_get_electron_ee_distance(context, distance);
rc = qmckl_get_electron_ee_distance(context, distance);
munit_assert_double(distance[0], ==, 0.);
munit_assert_double(distance[1], ==, distance[num]);
munit_assert_double_equal(distance[1], 8.6114953086801, 12);
assert(distance[0] == 0.);
assert(distance[1] == distance[num]);
assert(abs(distance[1]-8.6114953086801) < 1.e-12);
#+end_src
@ -624,7 +624,7 @@ munit_assert_double_equal(distance[1], 8.6114953086801, 12);
#+begin_src c :tangle (eval c_test)
if (qmckl_context_destroy(context) != QMCKL_SUCCESS)
return QMCKL_FAILURE;
return MUNIT_OK;
return 0;
}
#+end_src

View File

@ -31,11 +31,11 @@
#+begin_src c :tangle (eval c_test) :noweb yes
#include "qmckl.h"
#include "munit.h"
#include "assert.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
MunitResult test_<<filename()>>() {
int main() {
#+end_src
#+end_src
@ -360,7 +360,7 @@ if (x < 0) {
** Test
#+begin_src c :comments link :tangle (eval c_test)
return MUNIT_OK;
return 0;
}
#+end_src

View File

@ -31,13 +31,13 @@ optimized libraries to fine-tune the memory allocation.
#+begin_src c :tangle (eval c_test) :noweb yes
#include "qmckl.h"
#include "munit.h"
#include "assert.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "qmckl_context_private_type.h"
#include "qmckl_memory_private_func.h"
MunitResult test_<<filename()>>() {
int main() {
#+end_src
@ -170,19 +170,19 @@ info.size = (size_t) 3;
int *a = (int*) qmckl_malloc(context, info);
/* Check that array of ints is OK */
munit_assert(a != NULL);
a[0] = 1; munit_assert_int(a[0], ==, 1);
a[1] = 2; munit_assert_int(a[1], ==, 2);
a[2] = 3; munit_assert_int(a[2], ==, 3);
assert(a != NULL);
a[0] = 1; assert(a[0] == 1);
a[1] = 2; assert(a[1] == 2);
a[2] = 3; assert(a[2] == 3);
/* Allocate another array of ints */
int *b = (int*) qmckl_malloc(context, info);
/* Check that array of ints is OK */
munit_assert(b != NULL);
b[0] = 1; munit_assert_int(b[0], ==, 1);
b[1] = 2; munit_assert_int(b[1], ==, 2);
b[2] = 3; munit_assert_int(b[2], ==, 3);
assert(b != NULL);
b[0] = 1; assert(b[0] == 1);
b[1] = 2; assert(b[1] == 2);
b[2] = 3; assert(b[2] == 3);
#+end_src
When freeing the memory with ~qmckl_free~, the context is passed, in
@ -246,28 +246,28 @@ qmckl_exit_code qmckl_free(qmckl_context context, void * const ptr) {
#+begin_src c :tangle (eval c_test) :exports none
qmckl_exit_code rc;
/* Assert that both arrays are allocated */
munit_assert(a != NULL);
munit_assert(b != NULL);
assert(a != NULL);
assert(b != NULL);
/* Free in NULL context */
rc = qmckl_free(QMCKL_NULL_CONTEXT, a);
munit_assert(rc == QMCKL_INVALID_CONTEXT);
assert(rc == QMCKL_INVALID_CONTEXT);
/* Free NULL pointer */
rc = qmckl_free(context, NULL);
munit_assert(rc == QMCKL_INVALID_ARG_2);
assert(rc == QMCKL_INVALID_ARG_2);
/* Free for the first time */
rc = qmckl_free(context, a);
munit_assert(rc == QMCKL_SUCCESS);
assert(rc == QMCKL_SUCCESS);
/* Free again */
rc = qmckl_free(context, a);
munit_assert(rc == QMCKL_FAILURE);
assert(rc == QMCKL_FAILURE);
/* Clean up */
rc = qmckl_context_destroy(context);
munit_assert(rc == QMCKL_SUCCESS);
assert(rc == QMCKL_SUCCESS);
#+end_src
@ -279,7 +279,7 @@ munit_assert(rc == QMCKL_SUCCESS);
#+end_src
** Test
#+begin_src c :comments org :tangle (eval c_test)
return MUNIT_OK;
return 0;
}
#+end_src

View File

@ -6,11 +6,11 @@
#+begin_src c :tangle (eval c_test) :noweb yes
#include "qmckl.h"
#include "munit.h"
#include "assert.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
MunitResult test_<<filename()>>() {
int main() {
#+end_src
#+begin_src c :tangle (eval h_private_type)
@ -327,7 +327,7 @@ double qmckl_get_numprec_epsilon(const qmckl_context context) {
*** Test
#+begin_src c :comments link :tangle (eval c_test)
return MUNIT_OK;
return 0;
}
#+end_src

View File

@ -15,7 +15,7 @@ function make_src()
cd ${srcdir}
declare -A DEPS DEPS_ORG DEPS_TEST
declare -A DEPS DEPS_ORG DEPS_TEST TESTS
C_FILES=
F_FILES=
@ -29,15 +29,14 @@ function make_src()
F_TEST_FILES=
TANGLED_FILES=
qmckl_f=" \$(srcdir)/src/qmckl_f.o"
for org in org/*.org ; do
i=$(basename ${org%.org})
tangled="\$(srcdir)/org/${i}.tangled"
c_test_o="\$(srcdir)/src/test_${i}.o"
f_test_o="\$(srcdir)/src/test_${i}_f.o"
c_test="\$(srcdir)/src/test_${i}.c"
f_test="\$(srcdir)/src/test_${i}_f.f90"
c_test_x="\$(srcdir)/tests/test_${i}"
c_test_o="\$(srcdir)/tests/test_${i}.o"
f_test_o="\$(srcdir)/tests/test_${i}_f.o"
c_test="\$(srcdir)/tests/test_${i}.c"
f_test="\$(srcdir)/tests/test_${i}_f.f90"
i="\$(srcdir)/src/${i}"
@ -93,7 +92,7 @@ function make_src()
grep -q "(eval f)" $org
if [[ $? -eq 0 ]] ; then
DEPS[$f90]+="$tangled "
DEPS[$fo]+="$f90 \$(qmckl_f)"
DEPS[$fo]+="$f90 \$(qmckl_fo)"
F_FILES+=" $f90"
fi
@ -112,64 +111,71 @@ function make_src()
grep -q "(eval c_test)" $org
if [[ $? -eq 0 ]] ; then
DEPS_TEST["${c_test}"]="${tangled} "
DEPS_TEST["${c_test_o}"]+=" ${c_test} $o \$(qmckl_h)"
C_TEST_FILES+=" ${c_test}"
TESTS["${c_test_x}"]+="${c_test} \$(qmckl_h)"
fi
grep -q "(eval f_test)" $org
if [[ $? -eq 0 ]] ; then
DEPS_TEST["${f_test}"]+="${tangled} "
DEPS_TEST["${f_test_o}"]+=" ${f_test} $fo \$(qmckl_f)"
F_TEST_FILES+=" ${f_test}"
TESTS["${c_test_x}"]+=" ${f_test} \$(test_qmckl_f)"
fi
done
OUTPUT=${WD}/generated.mk
echo > ${OUTPUT}
echo "## Source files" > ${OUTPUT}
echo >> ${OUTPUT}
echo "ORG_FILES=${ORG_FILES}" >> ${OUTPUT}
echo "TANGLED_FILES=${TANGLED_FILES}" >> ${OUTPUT}
echo "C_FILES=${C_FILES}" >> ${OUTPUT}
echo "F_FILES=${F_FILES}" >> ${OUTPUT}
echo "C_O_FILES=${C_O_FILES}" >> ${OUTPUT}
echo "F_O_FILES=${F_O_FILES}" >> ${OUTPUT}
echo "FH_FUNC_FILES=${FH_FUNC_FILES}" >> ${OUTPUT}
echo "FH_TYPE_FILES=${FH_TYPE_FILES}" >> ${OUTPUT}
echo "H_FUNC_FILES=${H_FUNC_FILES}" >> ${OUTPUT}
echo "H_TYPE_FILES=${H_TYPE_FILES}" >> ${OUTPUT}
echo "H_PRIVATE_FUNC_FILES=${H_PRIVATE_FUNC_FILES}" >> ${OUTPUT}
echo "H_PRIVATE_TYPE_FILES=${H_PRIVATE_TYPE_FILES}" >> ${OUTPUT}
echo "C_TEST_FILES=${C_TEST_FILES}" >> ${OUTPUT}
echo "F_TEST_FILES=${F_TEST_FILES}" >> ${OUTPUT}
echo >> ${OUTPUT}
echo
echo "## Source files"
echo
echo "ORG_FILES=${ORG_FILES}"
echo "TANGLED_FILES=${TANGLED_FILES}"
echo "C_FILES=${C_FILES}"
echo "F_FILES=${F_FILES}"
echo "C_O_FILES=${C_O_FILES}"
echo "F_O_FILES=${F_O_FILES}"
echo "FH_FUNC_FILES=${FH_FUNC_FILES}"
echo "FH_TYPE_FILES=${FH_TYPE_FILES}"
echo "H_FUNC_FILES=${H_FUNC_FILES}"
echo "H_TYPE_FILES=${H_TYPE_FILES}"
echo "H_PRIVATE_FUNC_FILES=${H_PRIVATE_FUNC_FILES}"
echo "H_PRIVATE_TYPE_FILES=${H_PRIVATE_TYPE_FILES}"
echo "C_TEST_FILES=${C_TEST_FILES}"
echo "F_TEST_FILES=${F_TEST_FILES}"
echo "TESTS=${!TESTS[@]}" | sed "s|\$(srcdir)/||g"
echo
echo >> ${OUTPUT}
echo "## Org-mode inherited dependencies" >> ${OUTPUT}
echo >> ${OUTPUT}
echo
echo "## Org-mode inherited dependencies"
echo
for f in ${!DEPS_ORG[@]} ; do
echo ${DEPS_ORG[$f]}: $f
echo " \$(tangle_verbose)\$(srcdir)/tools/tangle.sh $f"
echo ""
done >> ${OUTPUT}
echo >> ${OUTPUT}
done
echo
echo >> ${OUTPUT}
echo "## Source dependencies" >> ${OUTPUT}
echo >> ${OUTPUT}
echo
echo "## Source dependencies"
echo
for f in ${!DEPS[@]} ; do
echo "${f}: ${DEPS[$f]}"
done | sort >> ${OUTPUT}
done | sort
echo >> ${OUTPUT}
echo "## Test files" >> ${OUTPUT}
echo >> ${OUTPUT}
echo
echo "## Test files"
echo
for f in ${!DEPS_TEST[@]} ; do
echo "${f}: ${DEPS_TEST[$f]} \$(qmckl_h) \$(srcdir)/src/libqmckl.la"
done | sort >> ${OUTPUT}
echo "${f}: ${DEPS_TEST[$f]}"
done | sort
echo
echo "check_PROGRAMS = \$(TESTS)"
for f in ${!TESTS[@]} ; do
echo "tests_$(basename $f)_SOURCES = ${TESTS[$f]}" #| sed "s|\$(srcdir)/||"
echo "tests_$(basename $f)_LDADD = src/libqmckl.la"
done | sort
}
make_src
OUTPUT=${WD}/generated.mk
make_src > ${OUTPUT}

View File

@ -35,6 +35,7 @@
; The following is required to compute the file names
(setq pwd (file-name-directory buffer-file-name))
(setq wd (concat pwd "/../src/"))
(setq td (concat pwd "/../tests/"))
(setq name (file-name-nondirectory (substring buffer-file-name 0 -4)))
(setq f (concat wd name "_f.f90"))
(setq fh_func (concat wd name "_fh_func.f90"))
@ -44,7 +45,7 @@
(setq h_type (concat wd name "_type.h"))
(setq h_private_type (concat wd name "_private_type.h"))
(setq h_private_func (concat wd name "_private_func.h"))
(setq c_test (concat wd "test_" name ".c"))
(setq f_test (concat wd "test_" name "_f.f90"))
(setq c_test (concat td "test_" name ".c"))
(setq f_test (concat td "test_" name "_f.f90"))
(org-babel-lob-ingest "../tools/lib.org")