-# Doxygen configuration generated by Doxywizard version 0.1
+# Doxyfile 0.1
+
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = Check
PROJECT_NUMBER = 0.7.0
-OUTPUT_DIRECTORY = /home/amalec/check/doc/
+OUTPUT_DIRECTORY = ./doc/
OUTPUT_LANGUAGE = English
EXTRACT_ALL = NO
EXTRACT_PRIVATE = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
CASE_SENSE_NAMES = YES
+SHORT_NAMES = NO
HIDE_SCOPE_NAMES = NO
VERBATIM_HEADERS = YES
SHOW_INCLUDE_FILES = YES
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
-INPUT = /home/amalec/check/src/check.h
+INPUT = ./src/check.h
FILE_PATTERNS =
RECURSIVE = NO
EXCLUDE =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
-GENERATE_HTML = YES
+GENERATE_HTML = NO
HTML_OUTPUT =
HTML_HEADER =
HTML_FOOTER =
#---------------------------------------------------------------------------
GENERATE_LATEX = YES
LATEX_OUTPUT =
-COMPACT_LATEX = NO
+COMPACT_LATEX = YES
PAPER_TYPE = letter
EXTRA_PACKAGES =
LATEX_HEADER =
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
+RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
-GENERATE_MAN = NO
+GENERATE_MAN = YES
MAN_OUTPUT = man
MAN_EXTENSION = .3
+MAN_LINKS = YES
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+GENERATE_XML = NO
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
echo "$ac_t""no" 1>&6
fi
+if test -n "$GCC"; then
+ CFLAGS="$CFLAGS -Wall -Wstrict-prototypes -Wmissing-prototypes"
+fi
echo $ac_n "checking for lyx with linuxdoc""... $ac_c" 1>&6
-echo "configure:1174: checking for lyx with linuxdoc" >&5
+echo "configure:1177: checking for lyx with linuxdoc" >&5
ck_lyxchkconfig="chkconfig.ltx"
ck_lyxenvdir="$LYX_DIR_11x"
# Extract the first word of "sgml2html", so it can be a program name with args.
set dummy sgml2html; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1201: checking for $ac_word" >&5
+echo "configure:1204: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_have_sgmltools'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1241: checking how to run the C preprocessor" >&5
+echo "configure:1244: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 1256 "configure"
+#line 1259 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1262: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1265: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 1273 "configure"
+#line 1276 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1279: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1282: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 1290 "configure"
+#line 1293 "configure"
#include "confdefs.h"
#include <assert.h>
Syntax Error
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1296: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1299: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
echo "$ac_t""$CPP" 1>&6
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1321: checking for ANSI C header files" >&5
+echo "configure:1324: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1326 "configure"
+#line 1329 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1334: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1337: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 1351 "configure"
+#line 1354 "configure"
#include "confdefs.h"
#include <string.h>
EOF
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 1369 "configure"
+#line 1372 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
:
else
cat > conftest.$ac_ext <<EOF
-#line 1390 "configure"
+#line 1393 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
exit (0); }
EOF
-if { (eval echo configure:1401: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1404: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
fi
echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:1425: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:1428: checking for sys/wait.h that is POSIX.1 compatible" >&5
if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1430 "configure"
+#line 1433 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/wait.h>
s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
; return 0; }
EOF
-if { (eval echo configure:1446: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1449: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_sys_wait_h=yes
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1470: checking for $ac_hdr" >&5
+echo "configure:1473: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1475 "configure"
+#line 1478 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1480: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1483: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1511: checking for working const" >&5
+echo "configure:1514: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1516 "configure"
+#line 1519 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:1565: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1568: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
fi
echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:1586: checking for pid_t" >&5
+echo "configure:1589: checking for pid_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1591 "configure"
+#line 1594 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:1619: checking for size_t" >&5
+echo "configure:1622: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1624 "configure"
+#line 1627 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
echo $ac_n "checking for vprintf""... $ac_c" 1>&6
-echo "configure:1653: checking for vprintf" >&5
+echo "configure:1656: checking for vprintf" >&5
if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1658 "configure"
+#line 1661 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vprintf(); below. */
; return 0; }
EOF
-if { (eval echo configure:1681: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1684: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_vprintf=yes"
else
if test "$ac_cv_func_vprintf" != yes; then
echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
-echo "configure:1705: checking for _doprnt" >&5
+echo "configure:1708: checking for _doprnt" >&5
if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1710 "configure"
+#line 1713 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char _doprnt(); below. */
; return 0; }
EOF
-if { (eval echo configure:1733: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1736: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func__doprnt=yes"
else
for ac_func in strerror
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1760: checking for $ac_func" >&5
+echo "configure:1763: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1765 "configure"
+#line 1768 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:1788: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1791: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_RANLIB
+if test -n "$GCC"; then
+ CFLAGS="$CFLAGS -Wall -Wstrict-prototypes -Wmissing-prototypes"
+fi
CK_LYX_LINUXDOC([have_lyx="yes"],[have_lyx="no"])
AC_CHECK_PROG(have_sgmltools,sgml2html,yes)
if test x"$have_sgmltools" != "xyes" -o x"$have_lyx" != "xyes" ; then
fi
fi
# End automatically added section
+# Automatically added by dh_installdocs
+if [ "$1" = configure ] && command -v install-docs >/dev/null 2>&1; then
+ install-docs -i /usr/share/doc-base/check-tutorial
+fi
+# End automatically added section
rm -f /usr/doc/check
fi
# End automatically added section
+# Automatically added by dh_installdocs
+if [ "$1" = remove -o "$1" = upgrade ] && \
+ command -v install-docs >/dev/null 2>&1; then
+ install-docs -r check-tutorial
+fi
+# End automatically added section
-check_0.7.1-1_i386.deb devel optional
+check_0.7.2-1_i386.deb devel optional
SUFFIXES = .sgml
-lyx_docs = example.lyx
-sgml_docs = example.sgml
-html_docs = example.html example-1.html example-2.html example-3.html example-4.html
+lyx_docs = tutorial.lyx
+sgml_docs = tutorial.sgml
+html_docs = tutorial.html tutorial-1.html tutorial-2.html tutorial-3.html tutorial-4.html
EXTRA_DIST = $(lyx_docs)
stay relatively clean and simple.
\layout Standard
+Unit tests are internally defined as static functions.
+ This means that the code to add unit tests to test cases must be in the
+ same compilation unit as the unit tests themselves.
+ This provides another reason to put the creation of the test suite in a
+ separate function: you may later want to keep one source file per suite;
+ defining a uniquely named suite creation function allows you later to define
+ a header file giving prototypes for all the suite creation functions, and
+ encapsulate the details of where and how unit tests are defined behind
+ those functions.
+ See the test program defined for Check itself for an example of this strategy.
+\layout Standard
+
The code in main bears some explanation.
We are creating a suite runner object from the suite we created in money_suite.
We then run the suite, using the CRNORMAL flag to specify that we should
END_TEST
\end_deeper
+\layout Standard
+
+There are currently some limitations to the setup/teardown functions.
+ They are run outside of the unit tests, and in the same address space as
+ the main test program.
+ This means two things:
+\layout Enumerate
+
+If the setup or teardown functions signal or exit they will take down the
+ entire test program.
+\layout Enumerate
+
+fail and friends can't be used within the setup/teardown functions to test
+ setup code.
+\layout Standard
+
+The setup and teardown functions are always called (unless, of course, setup
+ brings down the whole test program :-).
\layout Subsection
Multiple suites run through the same SRunner
\layout Standard
-In a large program, it will be convenient to create mutiple suites, each
+In a large program, it will be convenient to create multiple suites, each
testing a module of the program.
While one can create several test programs, each running one Suite, it
may be convenient to create one main test program, and use it to run multiple
TOPDIRFLAGS=--define "_topdir ${WD}"
RPMFLAGS=
-EXTRA_DISTS=check.spec
+EXTRA_DIST=check.spec
SOURCE_FILE=${PACKAGE}-${VERSION}.tar.gz
RPM_I386=./RPMS/i386/${PACKAGE}-$(VERSION)-1.i386.rpm
TOPDIRFLAGS = --define "_topdir ${WD}"
RPMFLAGS =
-EXTRA_DISTS = check.spec
+EXTRA_DIST = check.spec
SOURCE_FILE = ${PACKAGE}-${VERSION}.tar.gz
RPM_I386 = ./RPMS/i386/${PACKAGE}-$(VERSION)-1.i386.rpm
%doc %{_prefix}/share/doc/%{name}-%{version}/NEWS
%doc %{_prefix}/share/doc/%{name}-%{version}/README
%doc %{_prefix}/share/doc/%{name}-%{version}/COPYING
-%doc %{_prefix}/share/doc/%{name}-%{version}/example-1.html
-%doc %{_prefix}/share/doc/%{name}-%{version}/example-2.html
-%doc %{_prefix}/share/doc/%{name}-%{version}/example-3.html
-%doc %{_prefix}/share/doc/%{name}-%{version}/example-4.html
-%doc %{_prefix}/share/doc/%{name}-%{version}/example.html
-%doc %{_prefix}/share/doc/%{name}-%{version}/example.lyx
-%doc %{_prefix}/share/doc/%{name}-%{version}/example.sgml
+%doc %{_prefix}/share/doc/%{name}-%{version}/tutorial.html
+%doc %{_prefix}/share/doc/%{name}-%{version}/tutorial-1.html
+%doc %{_prefix}/share/doc/%{name}-%{version}/tutorial-2.html
+%doc %{_prefix}/share/doc/%{name}-%{version}/tutorial-3.html
+%doc %{_prefix}/share/doc/%{name}-%{version}/tutorial-4.html
+%doc %{_prefix}/share/doc/%{name}-%{version}/tutorial.lyx
+%doc %{_prefix}/share/doc/%{name}-%{version}/tutorial.sgml
%dir %{_prefix}/share/doc/%{name}-%{version}/examples
%doc %{_prefix}/share/doc/%{name}-%{version}/examples/money.h
%doc %{_prefix}/share/doc/%{name}-%{version}/examples/money.c
- Updated for 0.7.2
- Moved money example files to example subdirectory, and removed some
confusing files
+- Renamed the Tutorial files tutorial*.*
* Tue Jul 30 2001 Arien Malec <arien_malec@yahoo.com>
- Updated for 0.7.1
* Tue Jul 10 2001 Arien Malec <arien_malec@yahoo.com>
*/
#include <string.h>
#include <stdio.h>
+#include <stdlib.h>
#include "error.h"
#include "list.h"
#include "check.h"
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+/* Comments are in Doxygen format: see http://www.stack.nl/~dimitri/doxygen/ */
+
/*! \mainpage Check: a unit test framework for C
-\section overview Overview
-Check is a unit test framework for C. It features a simple interface for defining unit tests, putting little in the way of the developer. Tests are run in a separate address space, so Check can catch both assertion failures and code errors that cause segmentation faults or other signals. The output from unit tests can be used within source code editors and IDEs.
+\section overview
+
+Overview Check is a unit test framework for C. It features a simple
+interface for defining unit tests, putting little in the way of the
+developer. Tests are run in a separate address space, so Check can
+catch both assertion failures and code errors that cause segmentation
+faults or other signals. The output from unit tests can be used within
+source code editors and IDEs.
\section quickref Quick Reference
\subsection creating Creating
\par
-Unit tests are created with the #START_TEST/#END_TEST macro pair. The #fail_unless and #fail macros are used for creating checks within unit tests; the #mark_point macro is useful for trapping the location of signals and/or early exits.
+
+Unit tests are created with the #START_TEST/#END_TEST macro pair. The
+#fail_unless and #fail macros are used for creating checks within unit
+tests; the #mark_point macro is useful for trapping the location of
+signals and/or early exits.
\subsection managing Managing test cases and suites
\par
-Test cases are created with #tcase_create, unit tests are added with #tcase_add_test
+
+Test cases are created with #tcase_create, unit tests are added
+with #tcase_add_test
+
\par
-Suites are created with #suite_create, freed with #suite_free; test cases are added with #suite_add_tcase
+
+Suites are created with #suite_create, freed with #suite_free; test
+cases are added with #suite_add_tcase
\subsection running Running suites
\par
-Suites are run through an SRunner, which is created with #srunner_create, freed with #srunner_free. Additional suites can be added to an SRunner with #srunner_add_suite.
+
+Suites are run through an SRunner, which is created with
+#srunner_create, freed with #srunner_free. Additional suites can be
+added to an SRunner with #srunner_add_suite.
\par
+
Use #srunner_run_all to run a suite and print results.
*/
typedef struct Suite Suite;
/*! \brief opaque type for a test case
- A TCase represents a test case.
- Create with #tcase_create, free with #tcase_free.
- For the moment, test cases can only be run through a suite */
+
+A TCase represents a test case. Create with #tcase_create, free with
+#tcase_free. For the moment, test cases can only be run through a
+suite
+*/
+
typedef struct TCase TCase;
/*! type for a test function */
(function version -- use this when the macro won't work */
void _tcase_add_test (TCase *tc, TFun tf, char *fname);
-/*! Add fixture setup/teardown functions to a test case
- Note that setup/teardown functions are not run in a separate
- address space, like test functions, and so must not
- exit or signal (e.g., segfault) */
-void tc_set_fixture(TCase *tc, SFun setup, SFun teardown);
+/*!
+
+Add fixture setup/teardown functions to a test case Note that
+setup/teardown functions are not run in a separate address space, like
+test functions, and so must not exit or signal (e.g., segfault)
+
+*/
+void tcase_set_fixture(TCase *tc, SFun setup, SFun teardown);
/*! Internal function to mark the start of a test function */
void tcase_fn_start (int msqid, char *fname, char *file, int line);
/*! Start a unit test with START_TEST(unit_name), end with END_TEST
One must use braces within a START_/END_ pair to declare new variables */
#define START_TEST(__testname)\
-void __testname (int __msqid)\
+static void __testname (int __msqid)\
{\
tcase_fn_start (__msqid,""# __testname, __FILE__, __LINE__);
SRunner *srunner_create (Suite *s);
/*! Adds a Suite to an SRunner */
-void *srunner_add_suite (SRunner *sr, Suite *s);
+void srunner_add_suite (SRunner *sr, Suite *s);
/*! Frees an SRunner */
void srunner_free (SRunner *sr);
int srunner_ntests_run (SRunner *sr);
/*! \brief Return an array of results for all failures
- Number of failures is equal to #srunner_nfailed_tests.
- Memory is alloc'ed and must be freed, but individual
- TestResults must not */
- TestResult **srunner_failures (SRunner *sr);
-
- /*! \brief Return an array of results for all run tests
- Number of failrues is equal to #srunner_ntests_run
- Memory is alloc'ed and must be freed, but individual
- TestResults must not */
- TestResult **srunner_results (SRunner *sr);
+
+ Number of failures is equal to #srunner_nfailed_tests. Memory is
+ alloc'ed and must be freed, but individual TestResults must not */
+
+TestResult **srunner_failures (SRunner *sr);
+
+/*! \brief Return an array of results for all run tests
+
+Number of failrues is equal to #srunner_ntests_run Memory is alloc'ed
+and must be freed, but individual TestResults must not */
+
+TestResult **srunner_results (SRunner *sr);
/* Printing */
/*! Print the results contained in an SRunner
- \param sr SRunner for which results are printed
- \param print_mode Specification of print verbosity, constrainted to enum #print_verbosity
+
+\param sr SRunner for which results are printed
+
+\param print_mode Specification of print verbosity, constrainted to
+enum #print_verbosity
*/
void srunner_print (SRunner *sr, int print_mode);
{
TestResult *tr;
Suite *s;
- List *trlst;
switch (evt) {
case CLSTART_SR:
break;
case CLEND_SR:
if (printmode > CRSILENT) {
- TestStats *ts = sr->stats;
fprintf (file, "\n");
srunner_fprint (file, sr, printmode);
}
{
TestResult *tr;
Suite *s;
- List *trlst;
switch (evt) {
case CLSTART_SR:
#include <errno.h>
#include <string.h>
#include <stdio.h>
+#include <stdlib.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include "list.h"
#include "check_impl.h"
#include "check_print.h"
+#include "error.h"
static void srunner_fprint_summary (FILE *file, SRunner *sr, int print_mode);
static void srunner_fprint_results (FILE *file, SRunner *sr, int print_mode);
case CRERROR:
return "E";
break;
+ default:
+ eprintf("Bad argument %d to rtype_to_string", rtype);
+ return NULL;
}
}
return sr;
}
-void *srunner_add_suite (SRunner *sr, Suite *s)
+void srunner_add_suite (SRunner *sr, Suite *s)
{
list_add_end(sr->slst, s);
}
#include <stdio.h>
#include <stdlib.h>
#include <check.h>
+#include "check_check.h"
START_TEST(test_set_log)
#include <stdlib.h>
+#include <stdio.h>
#include <check.h>
#include "check_check.h"
START_TEST(test_check_failure_tcnames)
{
int i;
+ char *tcnamearr[] = {
+ "Simple Tests",
+ "Simple Tests",
+ "Simple Tests",
+ "Simple Tests",
+ "Signal Tests",
+ "Signal Tests",
+ "Signal Tests",
+ "Limit Tests",
+ "Limit Tests",
+ "Core"};
+
for (i = 0; i < sub_nfailed; i++) {
-
- fail_unless (strcmp(tr_tcname(tr_fail_array[i]), "Check Servant") == 0,
- "Bad test case name");
+ char *tcname;
+ tcname = tr_tcname(tr_all_array[i]);
+ if (strcmp (tcname, tcnamearr[i]) != 0) {
+ char *emsg = malloc (CMAXMSG);
+ snprintf (emsg, CMAXMSG,"Expected %s, got %s", tcnamearr[i], tcname);
+ fail (emsg);
+ free (emsg);
+ }
}
}
END_TEST
END_TEST
int test_fixture_val = 0;
-void test_fixture_setup (void)
+static void test_fixture_setup (void)
{
test_fixture_val = 1;
}
}
END_TEST
-void test_fixture_teardown (void)
+static void test_fixture_teardown (void)
{
test_fixture_val = 3;
}
tcase_add_test (tc_core, test_check_failure_ftypes);
tcase_add_test (tc_core, test_check_failure_lnos);
tcase_add_test (tc_core, test_check_failure_lfiles);
+ tcase_add_test (tc_core, test_check_failure_tcnames);
tcase_add_test (tc_core, test_check_all_msgs);
tcase_add_test (tc_core, test_check_all_ftypes);
tcase_set_fixture(tc_fixture, test_fixture_setup, test_fixture_teardown);
void setup (void)
{
- char *msg;
Suite *s = make_sub_suite();
SRunner *sr = srunner_create(s);
srunner_add_suite(sr, make_sub2_suite());
#include <stdlib.h>
#include <check.h>
#include "check_msg.h"
+#include "check_check.h"
int msq;
-void msg_setup (void)
+static void msg_setup (void)
{
/* Note that we are really sharing the same msq
as check itself, since all msqs created by
#include <stdlib.h>
#include "list.h"
#include "check.h"
-
+#include "check_check.h"
START_TEST(test_create)
{
#include <time.h>
#include <stdlib.h>
+#include <stdio.h>
#include <check.h>
END_TEST
-void run (int num_iters)
+static void run (int num_iters)
{
int i;
s = suite_create ("Stress");
}
END_TEST
-Suite *make_s1_suite (void)
+static Suite *make_s1_suite (void)
{
Suite *s;
TCase *tc;
return s;
}
-Suite *make_s2_suite (void)
+static Suite *make_s2_suite (void)
{
Suite *s;
TCase *tc;
return s;
}
-void run_tests (int printmode)
+static void run_tests (int printmode)
{
SRunner *sr;
}
END_TEST
-Suite *make_suite (void)
+static Suite *make_suite (void)
{
Suite *s;
TCase *tc;
return s;
}
-void run_tests (int printmode)
+static void run_tests (int printmode)
{
SRunner *sr;
Suite *s;