Commit 7d736a36 authored by jds2's avatar jds2

Merge jds-v2-expt into HEAD. Release 2.0-1.


git-svn-id: http://svn.code.sf.net/p/cunit/code/trunk@56 f00e6729-6848-4c17-8bfb-678c97c00071
parent 03e93a14
......@@ -3,6 +3,18 @@ Microsoft Developer Studio Workspace File, Format Version 6.00
###############################################################################
Project: "CUnit"=".\CUnit\CUnit.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "AutomatedTest"=".\EXAMPLES\AutomatedTest\AutomatedTest.dsp" - Package Owner=<4>
Package=<5>
......@@ -18,7 +30,7 @@ Package=<4>
###############################################################################
Project: "CUnit"=".\CUnit\CUnit.dsp" - Package Owner=<4>
Project: "BasicTest"=".\EXAMPLES\BasicTest\BasicTest.dsp" - Package Owner=<4>
Package=<5>
{{{
......@@ -26,6 +38,9 @@ Package=<5>
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name CUnit
End Project Dependency
}}}
###############################################################################
......
Summary: A unit testing framework for 'C'
Name: CUnit
Version: 1.1
Release: 2
Source: http://www.sourceforge.net/projects/cunit/CUnit-1.1-2.tar.gz
Version: 2.0
Release: 1
Source: http://www.sourceforge.net/projects/cunit/CUnit-2.0-1.tar.gz
Group: Development/Tools
License: GPL
URL: http://cunit.sourceforge.net
......@@ -15,7 +15,7 @@ headers, and documentation files.
%prep
echo "Preparing for Installation."
%setup -q -n CUnit-1.1-2
%setup -q -n CUnit-2.0-1
%build
echo "Preparing for Building."
......@@ -33,40 +33,54 @@ make DESTDIR=$RPM_BUILD_ROOT install
########### Include Files
%{_prefix}/include/CUnit/Automated.h
%{_prefix}/include/CUnit/Basic.h
%{_prefix}/include/CUnit/Console.h
%{_prefix}/include/CUnit/Curses.h
%{_prefix}/include/CUnit/CUError.h
%{_prefix}/include/CUnit/CUnit.h
%{_prefix}/include/CUnit/Errno.h
%{_prefix}/include/CUnit/Curses.h
%{_prefix}/include/CUnit/MyMem.h
%{_prefix}/include/CUnit/TestDB.h
%{_prefix}/include/CUnit/TestRun.h
%{_prefix}/include/CUnit/Util.h
########## Library File
%{_prefix}/lib/libcunit.a
########## doc Files
%{_prefix}/doc/CUnit/CUnit_doc.css
%{_prefix}/doc/CUnit/error_handling.html
%{_prefix}/doc/CUnit/fdl.html
%{_prefix}/doc/CUnit/index.html
%{_prefix}/doc/CUnit/introduction.html
%{_prefix}/doc/CUnit/managing_tests.html
%{_prefix}/doc/CUnit/running_tests.html
%{_prefix}/doc/CUnit/test_registry.html
%{_prefix}/doc/CUnit/writing_tests.html
%{_prefix}/doc/CUnit/headers/Automated.h
%{_prefix}/doc/CUnit/headers/Basic.h
%{_prefix}/doc/CUnit/headers/Console.h
%{_prefix}/doc/CUnit/headers/CUError.h
%{_prefix}/doc/CUnit/headers/CUnit.h
%{_prefix}/doc/CUnit/headers/Curses.h
%{_prefix}/doc/CUnit/headers/MyMem.h
%{_prefix}/doc/CUnit/headers/TestDB.h
%{_prefix}/doc/CUnit/headers/TestRun.h
%{_prefix}/doc/CUnit/headers/Util.h
%{_prefix}/doc/CUnit/headers/Win.h
########## Manpage Files
%{_prefix}/man/man3/add_test_case.3.*
%{_prefix}/man/man3/add_test_group.3.*
%{_prefix}/man/man3/ASSERT.3.*
%{_prefix}/man/man3/automated_run_tests.3.*
%{_prefix}/man/man3/cleanup_registry.3.*
%{_prefix}/man/man3/console_run_tests.3.*
%{_prefix}/man/man3/curses_run_tests.3.*
%{_prefix}/man/man3/get_error.3.*
%{_prefix}/man/man3/get_registry.3.*
%{_prefix}/man/man3/initialize_registry.3.*
%{_prefix}/man/man3/set_output_filename.3.*
%{_prefix}/man/man3/set_registry.3.*
%{_prefix}/man/man8/CUnit.8.*
%{_prefix}/man/man3/CUnit.3*
########## Share information and Example Files
%{_prefix}/share/CUnit-1.1-2/Example/Automated/README
%{_prefix}/share/CUnit-1.1-2/Example/Automated/AutomatedTest
%{_prefix}/share/CUnit-1.1-2/Example/Console/README
%{_prefix}/share/CUnit-1.1-2/Example/Console/ConsoleTest
%{_prefix}/share/CUnit-1.1-2/Example/Curses/README
%{_prefix}/share/CUnit-1.1-2/Example/Curses/CursesTest
%{_prefix}/share/CUnit-1.1-2/Example/Register/README
%{_prefix}/share/CUnit-1.1-2/Example/Register/RegisterTest
%{_prefix}/share/CUnit/Examples/Automated/README
%{_prefix}/share/CUnit/Examples/Automated/AutomatedTest
%{_prefix}/share/CUnit/Examples/Basic/README
%{_prefix}/share/CUnit/Examples/Basic/BasicTest
%{_prefix}/share/CUnit/Examples/Console/README
%{_prefix}/share/CUnit/Examples/Console/ConsoleTest
%{_prefix}/share/CUnit/Examples/Curses/README
%{_prefix}/share/CUnit/Examples/Curses/CursesTest
%{_prefix}/share/CUnit/Test/test_cunit
%{_prefix}/share/CUnit/CUnit-List.dtd
%{_prefix}/share/CUnit/CUnit-List.xsl
%{_prefix}/share/CUnit/CUnit-Run.dtd
......
......@@ -33,40 +33,54 @@ make DESTDIR=$RPM_BUILD_ROOT install
########### Include Files
%{_prefix}/include/CUnit/Automated.h
%{_prefix}/include/CUnit/Basic.h
%{_prefix}/include/CUnit/Console.h
%{_prefix}/include/CUnit/Curses.h
%{_prefix}/include/CUnit/CUError.h
%{_prefix}/include/CUnit/CUnit.h
%{_prefix}/include/CUnit/Errno.h
%{_prefix}/include/CUnit/Curses.h
%{_prefix}/include/CUnit/MyMem.h
%{_prefix}/include/CUnit/TestDB.h
%{_prefix}/include/CUnit/TestRun.h
%{_prefix}/include/CUnit/Util.h
########## Library File
%{_prefix}/lib/libcunit.a
########## doc Files
%{_prefix}/doc/@PACKAGE@/CUnit_doc.css
%{_prefix}/doc/@PACKAGE@/error_handling.html
%{_prefix}/doc/@PACKAGE@/fdl.html
%{_prefix}/doc/@PACKAGE@/index.html
%{_prefix}/doc/@PACKAGE@/introduction.html
%{_prefix}/doc/@PACKAGE@/managing_tests.html
%{_prefix}/doc/@PACKAGE@/running_tests.html
%{_prefix}/doc/@PACKAGE@/test_registry.html
%{_prefix}/doc/@PACKAGE@/writing_tests.html
%{_prefix}/doc/@PACKAGE@/headers/Automated.h
%{_prefix}/doc/@PACKAGE@/headers/Basic.h
%{_prefix}/doc/@PACKAGE@/headers/Console.h
%{_prefix}/doc/@PACKAGE@/headers/CUError.h
%{_prefix}/doc/@PACKAGE@/headers/CUnit.h
%{_prefix}/doc/@PACKAGE@/headers/Curses.h
%{_prefix}/doc/@PACKAGE@/headers/MyMem.h
%{_prefix}/doc/@PACKAGE@/headers/TestDB.h
%{_prefix}/doc/@PACKAGE@/headers/TestRun.h
%{_prefix}/doc/@PACKAGE@/headers/Util.h
%{_prefix}/doc/@PACKAGE@/headers/Win.h
########## Manpage Files
%{_prefix}/man/man3/add_test_case.3.*
%{_prefix}/man/man3/add_test_group.3.*
%{_prefix}/man/man3/ASSERT.3.*
%{_prefix}/man/man3/automated_run_tests.3.*
%{_prefix}/man/man3/cleanup_registry.3.*
%{_prefix}/man/man3/console_run_tests.3.*
%{_prefix}/man/man3/curses_run_tests.3.*
%{_prefix}/man/man3/get_error.3.*
%{_prefix}/man/man3/get_registry.3.*
%{_prefix}/man/man3/initialize_registry.3.*
%{_prefix}/man/man3/set_output_filename.3.*
%{_prefix}/man/man3/set_registry.3.*
%{_prefix}/man/man8/CUnit.8.*
%{_prefix}/man/man3/CUnit.3*
########## Share information and Example Files
%{_prefix}/share/@PACKAGE@-@VERSION@-@RELEASE@/Example/Automated/README
%{_prefix}/share/@PACKAGE@-@VERSION@-@RELEASE@/Example/Automated/AutomatedTest
%{_prefix}/share/@PACKAGE@-@VERSION@-@RELEASE@/Example/Console/README
%{_prefix}/share/@PACKAGE@-@VERSION@-@RELEASE@/Example/Console/ConsoleTest
%{_prefix}/share/@PACKAGE@-@VERSION@-@RELEASE@/Example/Curses/README
%{_prefix}/share/@PACKAGE@-@VERSION@-@RELEASE@/Example/Curses/CursesTest
%{_prefix}/share/@PACKAGE@-@VERSION@-@RELEASE@/Example/Register/README
%{_prefix}/share/@PACKAGE@-@VERSION@-@RELEASE@/Example/Register/RegisterTest
%{_prefix}/share/@PACKAGE@/Examples/Automated/README
%{_prefix}/share/@PACKAGE@/Examples/Automated/AutomatedTest
%{_prefix}/share/@PACKAGE@/Examples/Basic/README
%{_prefix}/share/@PACKAGE@/Examples/Basic/BasicTest
%{_prefix}/share/@PACKAGE@/Examples/Console/README
%{_prefix}/share/@PACKAGE@/Examples/Console/ConsoleTest
%{_prefix}/share/@PACKAGE@/Examples/Curses/README
%{_prefix}/share/@PACKAGE@/Examples/Curses/CursesTest
%{_prefix}/share/@PACKAGE@/Test/test_cunit
%{_prefix}/share/@PACKAGE@/CUnit-List.dtd
%{_prefix}/share/@PACKAGE@/CUnit-List.xsl
%{_prefix}/share/@PACKAGE@/CUnit-Run.dtd
......
......@@ -16,7 +16,7 @@ CFG=CUnit - Win32 Debug
!MESSAGE NMAKE /f "CUnit.mak" CFG="CUnit - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE
!MESSAGE "CUnit - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "CUnit - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
......@@ -74,7 +74,7 @@ LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
!ENDIF
# Begin Target
......@@ -85,11 +85,11 @@ LIB32=link.exe -lib
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\Sources\Framework\AssertImpl.c
SOURCE=.\Sources\Automated\Automated.c
# End Source File
# Begin Source File
SOURCE=.\Sources\Automated\Automated.c
SOURCE=.\Sources\Basic\Basic.c
# End Source File
# Begin Source File
......@@ -97,6 +97,10 @@ SOURCE=.\Sources\Console\Console.c
# End Source File
# Begin Source File
SOURCE=.\Sources\Framework\CUError.c
# End Source File
# Begin Source File
SOURCE=.\Sources\Framework\MyMem.c
# End Source File
# Begin Source File
......@@ -121,15 +125,19 @@ SOURCE=.\Headers\Automated.h
# End Source File
# Begin Source File
SOURCE=.\Headers\Basic.h
# End Source File
# Begin Source File
SOURCE=.\Headers\Console.h
# End Source File
# Begin Source File
SOURCE=.\Headers\CUnit.h
SOURCE=.\Headers\CUError.h
# End Source File
# Begin Source File
SOURCE=.\Headers\Errno.h
SOURCE=.\Headers\CUnit.h
# End Source File
# Begin Source File
......@@ -143,6 +151,10 @@ SOURCE=.\Headers\TestDB.h
SOURCE=.\Headers\TestRun.h
# End Source File
# Begin Source File
SOURCE=.\Headers\Util.h
# End Source File
# End Group
# End Target
# End Project
This diff is collapsed.
/*
* CUnit - A Unit testing framework library for C.
* Copyright (C) 2001 Anil Kumar
*
* Copyright (C) 2004 Anil Kumar, Jerry St.Clair
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
......@@ -18,16 +19,26 @@
*/
/*
* Contains Interface for console Run tests.
* Contains Interface for console Run tests.
*
* Created By : Anil Kumar on ...(in month of Aug 2001)
* Last Modified : 09/Aug/2001
* Comment : Single interface to Console_run_tests
* EMail : aksaharan@yahoo.com
*
* Created By : Anil Kumar on ...(in month of Aug 2001)
* Last Modified : 09/Aug/2001
* Comment : Single interface to Console_run_tests
* EMail : aksaharan@yahoo.com
* Modified : 18-Jul-2004 (JDS)
* Comment : New interface
* EMail : jds2@users.sourceforge.net
*/
/** @file
* Curses testing interface with interactive output (user interface).
*/
/** @addtogroup Curses
* @{
*/
#ifndef _CUNIT_CURSES_H
#define _CUNIT_CURSES_H 1
#define _CUNIT_CURSES_H
#include "CUnit.h"
#include "TestDB.h"
......@@ -36,9 +47,17 @@
extern "C" {
#endif
extern void curses_run_tests(void);
void CU_curses_run_tests(void);
#ifdef USE_DEPRECATED_CUNIT_NAMES
/** Deprecated (version 1). @deprecated Use CU_curses_run_tests(). */
#define curses_run_tests() CU_curses_run_tests()
#endif
#ifdef __cplusplus
}
#endif
#endif /* _CUNIT_CONSOLE_H */
/** @} */
......@@ -21,19 +21,17 @@
SubDir TOP CUnit Headers ;
CU_HEADERS =
Automated.h
Console.h
CUnit.h
Curses.h
Errno.h
MyMem.h
TestDB.h
TestRun.h
Util.h ;
if $(INSTALL_INC_DIR)
{
InstallFile $(INSTALL_INC_DIR) : $(CU_HEADERS) ;
InstallCUnitFile $(INSTALL_INC_DIR) :
<$(SOURCE_GRIST)>Automated.h
<$(SOURCE_GRIST)>Basic.h
<$(SOURCE_GRIST)>Console.h
<$(SOURCE_GRIST)>CUError.h
<$(SOURCE_GRIST)>CUnit.h
<$(SOURCE_GRIST)>Curses.h
<$(SOURCE_GRIST)>MyMem.h
<$(SOURCE_GRIST)>TestDB.h
<$(SOURCE_GRIST)>TestRun.h
<$(SOURCE_GRIST)>Util.h ;
}
......@@ -45,7 +45,7 @@ AUTOMAKE = automake-1.7
AWK = gawk
CC = gcc
CCDEPMODE = depmode=gcc3
CFLAGS = -DRELEASE=2 -Wall -I/home/jds/dev/CUnit-1.1-2/CUnit/Headers
CFLAGS = -DRELEASE=1 -Wall -I/home/jds/dev/CUnit-2.0-1/CUnit/Headers
CPP = gcc -E
CPPFLAGS =
CYGPATH_W = echo
......@@ -60,7 +60,7 @@ INSTALL_DATA = ${INSTALL} -m 644
INSTALL_PROGRAM = ${INSTALL}
INSTALL_SCRIPT = ${INSTALL}
INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
LDFLAGS = -L/home/jds/dev/CUnit-1.1-2/CUnit/Sources
LDFLAGS = -L/home/jds/dev/CUnit-2.0-1/CUnit/Sources
LIBOBJS =
LIBS = -lc
LTLIBOBJS =
......@@ -68,17 +68,17 @@ MAKEINFO = makeinfo
OBJEXT = o
PACKAGE = CUnit
PACKAGE_BUGREPORT =
PACKAGE_NAME =
PACKAGE_STRING =
PACKAGE_TARNAME =
PACKAGE_VERSION =
PACKAGE_NAME = CUnit
PACKAGE_STRING = CUnit 2.0-1
PACKAGE_TARNAME = cunit
PACKAGE_VERSION = 2.0-1
PATH_SEPARATOR = :
RANLIB = ranlib
RELEASE = 2
RELEASE = 1
SET_MAKE =
SHELL = /bin/sh
STRIP =
VERSION = 1.1
VERSION = 2.0
ac_ct_CC = gcc
ac_ct_RANLIB = ranlib
ac_ct_STRIP =
......@@ -93,7 +93,7 @@ exec_prefix = ${prefix}
host_alias =
includedir = ${prefix}/include
infodir = ${prefix}/info
install_sh = /home/jds/dev/CUnit-1.1-2/install-sh
install_sh = /home/jds/dev/CUnit-2.0-1/install-sh
libdir = ${exec_prefix}/lib
libexecdir = ${exec_prefix}/libexec
localstatedir = ${prefix}/var
......@@ -108,12 +108,19 @@ target_alias =
CUnitIncludedir = ${includedir}/CUnit
AUTOMATED_INCLUDES = Automated.h
BASIC_INCLUDES = Basic.h
CONSOLE_INCLUDES = Console.h
CURSES_INCLUDES = Curses.h
FRAMEWORK_INCLUDES = CUnit.h Errno.h TestDB.h TestRun.h
FRAMEWORK_INCLUDES = CUError.h CUnit.h MyMem.h TestDB.h TestRun.h Util.h
# Default configuration without enabling anything
INCLUDE_FILES = ${FRAMEWORK_INCLUDES} ${CONSOLE_INCLUDES} ${CURSES_INCLUDES} ${AUTOMATED_INCLUDES}
INCLUDE_FILES = \
${FRAMEWORK_INCLUDES} \
${CONSOLE_INCLUDES} \
${CURSES_INCLUDES} \
${AUTOMATED_INCLUDES} \
${BASIC_INCLUDES}
CUnitInclude_HEADERS = ${INCLUDE_FILES}
subdir = CUnit/Headers
......@@ -322,9 +329,6 @@ uninstall-am: uninstall-CUnitIncludeHEADERS uninstall-info-am
pdf-am ps ps-am tags uninstall uninstall-CUnitIncludeHEADERS \
uninstall-am uninstall-info-am
#Util.h, TestRun.h are not included because these are used internally
#by the CUnit files but is not for the external inclusion.
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
CUnitIncludedir=${includedir}/CUnit
AUTOMATED_INCLUDES = Automated.h
BASIC_INCLUDES = Basic.h
CONSOLE_INCLUDES = Console.h
CURSES_INCLUDES = Curses.h
FRAMEWORK_INCLUDES = CUnit.h Errno.h TestDB.h TestRun.h
FRAMEWORK_INCLUDES = CUError.h CUnit.h MyMem.h TestDB.h TestRun.h Util.h
# Default configuration without enabling anything
INCLUDE_FILES = ${FRAMEWORK_INCLUDES} ${CONSOLE_INCLUDES} ${CURSES_INCLUDES} ${AUTOMATED_INCLUDES}
INCLUDE_FILES = \
${FRAMEWORK_INCLUDES} \
${CONSOLE_INCLUDES} \
${CURSES_INCLUDES} \
${AUTOMATED_INCLUDES} \
${BASIC_INCLUDES}
CUnitInclude_HEADERS = ${INCLUDE_FILES}
#Util.h, TestRun.h are not included because these are used internally
#by the CUnit files but is not for the external inclusion.
......@@ -108,12 +108,19 @@ target_alias = @target_alias@
CUnitIncludedir = ${includedir}/CUnit
AUTOMATED_INCLUDES = Automated.h
BASIC_INCLUDES = Basic.h
CONSOLE_INCLUDES = Console.h
CURSES_INCLUDES = Curses.h
FRAMEWORK_INCLUDES = CUnit.h Errno.h TestDB.h TestRun.h
FRAMEWORK_INCLUDES = CUError.h CUnit.h MyMem.h TestDB.h TestRun.h Util.h
# Default configuration without enabling anything
INCLUDE_FILES = ${FRAMEWORK_INCLUDES} ${CONSOLE_INCLUDES} ${CURSES_INCLUDES} ${AUTOMATED_INCLUDES}
INCLUDE_FILES = \
${FRAMEWORK_INCLUDES} \
${CONSOLE_INCLUDES} \
${CURSES_INCLUDES} \
${AUTOMATED_INCLUDES} \
${BASIC_INCLUDES}
CUnitInclude_HEADERS = ${INCLUDE_FILES}
subdir = CUnit/Headers
......@@ -322,9 +329,6 @@ uninstall-am: uninstall-CUnitIncludeHEADERS uninstall-info-am
pdf-am ps ps-am tags uninstall uninstall-CUnitIncludeHEADERS \
uninstall-am uninstall-info-am
#Util.h, TestRun.h are not included because these are used internally
#by the CUnit files but is not for the external inclusion.
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
/*
* CUnit - A Unit testing framework library for C.
* Copyright (C) 2001 Anil Kumar
*
* Copyright (C) 2004 Anil Kumar, Jerry St.Clair
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
......@@ -21,41 +22,89 @@
* Contains Memory Related Defines to use internal routines to detect Memory Leak
* in Debug Versions
*
* Created By : Anil Kumar on ...(18 June 2002)
* Last Modified : 18/Jun/2002
* Comment : Memory Debug Funstions
* EMail : aksaharan@yahoo.com
* Created By : Anil Kumar on ...(18 June 2002)
* Last Modified : 18/Jun/2002
* Comment : Memory Debug Functions
* EMail : aksaharan@yahoo.com
*
* Modified : 17-Jul-2004 (JDS)
* Comment : New interface for global function names.
* EMail : jds2@users.sourceforge.net
*
* Modified : 5-Sep-2004 (JDS)
* Comment : Added internal test interface.
* EMail : jds2@users.sourceforge.net
*/
/** @file
* Memory management functions (user interface).
* Two versions of memory allocation/deallocation are available.
* If compiled with MEMTRACE defined, CUnit keeps track of all
* system allocations & deallocations. The memory record can
* then be reported using CU_DUMP_MEMORY_USAGE. Otherwise,
* standard system memory allocation is used without tracing.
*/
/** @addtogroup Framework
* @{
*/
#ifndef _CUNIT_MYMEM_H
#define _CUNIT_MYMEM_H 1
#define _CUNIT_MYMEM_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef MEMTRACE
void* my_calloc(size_t nmemb, size_t size, unsigned int uiLine, const char* szFileName);
void* my_malloc(size_t size, unsigned int uiLine, const char* szFileName);
void my_free(void *ptr, unsigned int uiLine, const char* szFileName);
void* my_realloc(void *ptr, size_t size, unsigned int uiLine, const char* szFileName);
void dump_memory_usage(void);
#define MY_CALLOC(x, y) my_calloc((x), (y), __LINE__, __FILE__)
#define MY_MALLOC(x) my_malloc((x), __LINE__, __FILE__)
#define MY_FREE(x) my_free((x), __LINE__, __FILE__)
#define MY_REALLOC(x, y) my_realloc((x), (y), __LINE__, __FILE__)
#define DUMP_MEMORY_USAGE() dump_memory_usage()
#ifdef MEMTRACE
void* CU_calloc(size_t nmemb, size_t size, unsigned int uiLine, const char* szFileName);
void* CU_malloc(size_t size, unsigned int uiLine, const char* szFileName);
void CU_free(void *ptr, unsigned int uiLine, const char* szFileName);
void* CU_realloc(void *ptr, size_t size, unsigned int uiLine, const char* szFileName);
void CU_dump_memory_usage(const char*);
/** c-allocate with memory tracking. */
#define CU_CALLOC(x, y) CU_calloc((x), (y), __LINE__, __FILE__)
/** m-allocate with memory tracking. */
#define CU_MALLOC(x) CU_malloc((x), __LINE__, __FILE__)
/** Free with memory tracking. */
#define CU_FREE(x) CU_free((x), __LINE__, __FILE__)
/** Reallocate with memory tracking. */
#define CU_REALLOC(x, y) CU_realloc((x), (y), __LINE__, __FILE__)
/** Generate report on tracked memory. */
#define CU_DUMP_MEMORY_USAGE(x) CU_dump_memory_usage((x))
#else
#define MY_CALLOC(x, y) calloc((x), (y))
#define MY_MALLOC(x) malloc((x))
#define MY_FREE(x) free((x))
#define MY_REALLOC(x, y) realloc((x), (y))
#define DUMP_MEMORY_USAGE()
#endif
/** Standard calloc() if MEMTRACE not defined. */
#define CU_CALLOC(x, y) calloc((x), (y))
/** Standard malloc() if MEMTRACE not defined. */
#define CU_MALLOC(x) malloc((x))
/** Standard free() if MEMTRACE not defined. */
#define CU_FREE(x) free((x))
/** Standard realloc() if MEMTRACE not defined. */
#define CU_REALLOC(x, y) realloc((x), (y))
/** No-op if MEMTRACE not defined. */
#define CU_DUMP_MEMORY_USAGE(x)
#endif
#ifdef CUNIT_BUILD_TESTS
/** Disable memory allocation for testing purposes. */
void test_cunit_deactivate_malloc(void);
/** Enable memory allocation for testing purposes. */
void test_cunit_activate_malloc(void);
/** Retrieve number of memory events for a given pointer */
unsigned int test_cunit_get_n_memevents(void* pLocation);
/** Retrieve number of allocations for a given pointer */
unsigned int test_cunit_get_n_allocations(void* pLocation);
/** Retrieve number of deallocations for a given pointer */
unsigned int test_cunit_get_n_deallocations(void* pLocation);
void test_cunit_MyMem(void);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _CUNIT_MYMEM_H */
/** @} */
This diff is collapsed.
/*
* CUnit - A Unit testing framework library for C.
* Copyright (C) 2001 Anil Kumar
*
* Copyright (C) 2004 Anil Kumar, Jerry St.Clair
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
......@@ -18,70 +19,173 @@
*/
/*
* Contains Interface to Run tests.
* Contains Interface to Run tests.
*
* Created By : Anil Kumar on ...(in month of Aug 2001)
* Last Modified : 09/Aug/2001
* Comment : Contains generic run tests interface which can be used
* be used for any type of frontend interface framework.
* EMail : aksaharan@yahoo.com
*
* Last Modified : 24/Nov/2001
* Comment : Added Handler for Group Initialization failure condition.
* EMail : aksaharan@yahoo.com
*
* Last Modified : 5-Aug-2004 (JDS)
* Comment : New interface. Since these should be internal functions,
* no support for deprecated version 1 names provided now,
* eliminated global variables for current test & suite,
* moved (renamed) _TestResult here from TestDB.h.
* EMail : jds2@users.sourceforge.net
*
* Created By : Anil Kumar on ...(in month of Aug 2001)
* Last Modified : 09/Aug/2001
* Comment : Contains generic run tests interface which can be used
* be used for any type of frontend interface framework.
* EMail : aksaharan@yahoo.com
*
* Last Modified : 24/Nov/2001
* Comment : Added Handler for Group Initialization failure condition.
* EMail : aksaharan@yahoo.com
* Modified : 5-Sep-2004 (JDS)
* Comment : Added internal test interface.
* EMail : jds2@users.sourceforge.net
*/
/** @file
* Test run management functions (user interface).
* The TestRun module implements functions supporting the running
* of tests elements (suites and tests). This includes functions for
* running suites and tests, retrieving the number of tests/suites run,
* and managing callbacks during the run process.
* <P>The callback mechanism works as follows. The CUnit runtime system
* supports the registering and calling of functions at the start and end
* of each test, when all tests are complete, and when a suite
* initialialization function returns an error. This allows clients to
* perform actions associated with these events such as output formatting
* and reporting.</P>
*/
/** @addtogroup Framework
* @{
*/
#ifndef _CUNIT_TESTRUN_H
#define _CUNIT_TESTRUN_H 1
#define _CUNIT_TESTRUN_H
#include "CUnit.h"
#include "Errno.h"
#include "CUError.h"
#include "TestDB.h"
#ifdef __cplusplus
extern "C" {