Commit 55433ba8 authored by anilsaharan's avatar anilsaharan

Initial CUnit Version.


git-svn-id: http://svn.code.sf.net/p/cunit/code/trunk@7 f00e6729-6848-4c17-8bfb-678c97c00071
parent 7dd5197f
dnl aclocal.m4 generated automatically by aclocal 1.4
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE.
# Do all the work for Automake. This macro actually does too much --
# some checks are only needed if your package does certain things.
# But this isn't really a big deal.
# serial 1
dnl Usage:
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
AC_DEFUN(AM_INIT_AUTOMAKE,
[AC_REQUIRE([AC_PROG_INSTALL])
PACKAGE=[$1]
AC_SUBST(PACKAGE)
VERSION=[$2]
AC_SUBST(VERSION)
dnl test to see if srcdir already configured
if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
ifelse([$3],,
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
AC_REQUIRE([AM_SANITY_CHECK])
AC_REQUIRE([AC_ARG_PROGRAM])
dnl FIXME This is truly gross.
missing_dir=`cd $ac_aux_dir && pwd`
AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
AC_REQUIRE([AC_PROG_MAKE_SET])])
#
# Check to make sure that the build environment is sane.
#
AC_DEFUN(AM_SANITY_CHECK,
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftestfile
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
if test "[$]*" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftestfile`
fi
if test "[$]*" != "X $srcdir/configure conftestfile" \
&& test "[$]*" != "X conftestfile $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "[$]2" = conftestfile
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
rm -f conftest*
AC_MSG_RESULT(yes)])
dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
dnl The program must properly implement --version.
AC_DEFUN(AM_MISSING_PROG,
[AC_MSG_CHECKING(for working $2)
# Run test in a subshell; some versions of sh will print an error if
# an executable is not found, even if stderr is redirected.
# Redirect stdin to placate older versions of autoconf. Sigh.
if ($2 --version) < /dev/null > /dev/null 2>&1; then
$1=$2
AC_MSG_RESULT(found)
else
$1="$3/missing $2"
AC_MSG_RESULT(missing)
fi
AC_SUBST($1)])
# Define a conditional.
AC_DEFUN(AM_CONDITIONAL,
[AC_SUBST($1_TRUE)
AC_SUBST($1_FALSE)
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi])
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "CUnit"=.\CUnit\CUnit.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "ConsoleTest"=.\Examples\ConsoleTest\ConsoleTest.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name CUnit
End Project Dependency
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
# Microsoft Developer Studio Project File - Name="CUnit" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=CUnit - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "CUnit.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "CUnit.mak" CFG="CUnit - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "CUnit - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "CUnit - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "CUnit - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ""
# PROP Intermediate_Dir "Temp"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "./Headers" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "_DELAYTEST" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "CUnit - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ""
# PROP Intermediate_Dir "Temp"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "./Headers" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D "_DELAYTEST" /YX /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "CUnit - Win32 Release"
# Name "CUnit - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\Sources\AssertImpl.c
# End Source File
# Begin Source File
SOURCE=.\Sources\Console.c
# End Source File
# Begin Source File
SOURCE=.\Sources\TestDB.c
# End Source File
# Begin Source File
SOURCE=.\Sources\TestRun.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\Headers\Console.h
# End Source File
# Begin Source File
SOURCE=.\Headers\CUnit.h
# End Source File
# Begin Source File
SOURCE=.\Headers\Errno.h
# End Source File
# Begin Source File
SOURCE=.\Headers\TestDB.h
# End Source File
# Begin Source File
SOURCE=.\Headers\TestRun.h
# End Source File
# End Group
# End Target
# End Project
/*
* Contains ASSERT Macro definition
*
* Created By : Anil Kumar on ...(in month of Aug 2001)
* Last Modified : 09/Aug/2001
* Comment : ASSERT definition
* EMail : aksaharan@yahoo.com
*/
#ifndef _CUnit_h_
#define _CUnit_h_
#include "Errno.h"
#include "TestDB.h"
#include "TestRun.h"
#include "Console.h"
/*
* This is including the null character for termination. In effect it comes out
* to be 255 characters.
*/
#define MAX_TEST_NAME_LENGTH 256
#define MAX_GROUP_NAME_LENGTH 256
extern void assertImplementation(unsigned int bValue,unsigned int uiLine,
char strCondition[], char strFile[], char strFunction[]);
#undef ASSERT
#define ASSERT(value) if (0 == (int)(value)) { assertImplementation(value, __LINE__, #value, __FILE__, ""); return; }
#endif /* _CUnit_h_ */
/*
* 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
*/
#ifndef _Console_h_
#define _Console_h_
extern void console_run_tests(void);
#endif /* _Console_h_ */
/*
* Contains CUnit error codes which can be used externally.
*
* Created By : Anil Kumar on ...(in month of Aug 2001)
* Last Modified : 09/Aug/2001
* Comment : -------
* EMail : aksaharan@yahoo.com
*
* Modified : 02/Oct/2001
* Comment : Added proper Eror Codes
* EMail : aksaharan@yahoo.com
*
*/
#ifndef _Errno_h_
#define _Errno_h_
#include <errno.h>
#define CUE_SUCCESS 0
#define CUE_NOMEMORY 1
/* Test Registry Level Errors */
#define CUE_NOREGISTRY 10
#define CUE_REGISTRY_EXISTS 11
/* Test Group Level Errors */
#define CUE_NOGROUP 20
#define CUE_NO_GROUPNAME 21
#define CUE_GRPINIT_FAILED 22
#define CUE_GRPCLEAN_FAILED 23
/* Test Case Level Errors */
#define CUE_NOTEST 30
#define CUE_NO_TESTNAME 31
#endif /* _Errno_h_ */
include_HEADERS = \
Console.h \
CUnit.h \
Errno.h \
TestDB.h
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
CC = @CC@
MAKEINFO = @MAKEINFO@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
VERSION = @VERSION@
include_HEADERS = Console.h CUnit.h Errno.h TestDB.h
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
HEADERS = $(include_HEADERS)
DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar
GZIP_ENV = --best
all: all-redirect
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps CUnit/Headers/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
install-includeHEADERS: $(include_HEADERS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(includedir)
@list='$(include_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p"; \
$(INSTALL_DATA) $$d$$p $(DESTDIR)$(includedir)/$$p; \
done
uninstall-includeHEADERS:
@$(NORMAL_UNINSTALL)
list='$(include_HEADERS)'; for p in $$list; do \
rm -f $(DESTDIR)$(includedir)/$$p; \
done
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = CUnit/Headers
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am:
install-exec: install-exec-am
install-data-am: install-includeHEADERS
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-includeHEADERS
uninstall: uninstall-am
all-am: Makefile $(HEADERS)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(includedir)
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-tags mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-tags clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-tags distclean-generic clean-am
distclean: distclean-am
maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \
distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
.PHONY: uninstall-includeHEADERS install-includeHEADERS tags \
mostlyclean-tags distclean-tags clean-tags maintainer-clean-tags \
distdir info-am info dvi-am dvi check check-am installcheck-am \
installcheck install-exec-am install-exec install-data-am install-data \
install-am install uninstall-am uninstall all-redirect all-am all \
installdirs mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
# 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:
/*
* Contains all the Type Definitions and functions declarations
* for the CUnit test database maintenance.
*
* Created By : Anil Kumar on ...(in month of Aug 2001)
* Last Modified : 09/Aug/2001
* Comment : Added Preprocessor conditionals for the file.
* EMail : aksaharan@yahoo.com
*
* Last Modified : 24/aug/2001 by Anil Kumar
* Comment : Made the linked list from SLL to DLL(doubly linked list).
* EMail : aksaharan@yahoo.com
*/
#ifndef _TestDB_H_
#define _TestDB_H_
#include "Errno.h"
/*
* Type definition for Initialization/Cleaup/TestFunction for TestCase/TestGroup
*/
typedef int (*InitializeFunc)(void);
typedef int (*CleanupFunc)(void);
typedef void (*TestFunc)(void);
typedef struct _TestCase
{
char* pName;
TestFunc pTestFunc;
struct _TestCase* pNext;
struct _TestCase* pPrev;
}TestCase;
typedef TestCase *PTestCase;
typedef struct _TestGroup
{
char* pName;
PTestCase pTestCase;
InitializeFunc pInitializeFunc;
CleanupFunc pCleanupFunc;
unsigned int uiNumberOfTests;
struct _TestGroup* pNext;
struct _TestGroup* pPrev;
}TestGroup;
typedef TestGroup *PTestGroup;
typedef struct _TestResult
{
unsigned int uiLineNumber;
char* strFileName;
char* strCondition;
PTestCase pTestCase;
PTestGroup pTestGroup;
struct _TestResult* pNext;
struct _TestResult* pPrev;
}TestResult;
typedef TestResult *PTestResult;
typedef struct _TestRegistry
{
unsigned int uiNumberOfGroups;
unsigned int uiNumberOfTests;
unsigned int uiNumberOfFailures;
PTestGroup pGroup;
PTestResult pResult;
}TestRegistry;
typedef TestRegistry *PTestRegistry;
extern PTestRegistry g_pTestRegistry;
extern int error_number;
extern int initialize_registry(void);
extern void cleanup_registry(void);
extern PTestRegistry get_registry(void);
extern int set_registry(PTestRegistry pTestRegistry);
extern PTestGroup add_test_group(char* strName, InitializeFunc pInit, CleanupFunc pClean);
extern PTestCase add_test_case(PTestGroup pGroup, char* strName, TestFunc pTest);
extern void add_failure(unsigned int uiLineNumber, char szCondition[],
char szFileName[], PTestGroup pGroup, PTestCase pTest);
extern const char* get_error(void);
#endif /* _TestDB_H_ */
/*
* 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
*/
#ifndef _TestRun_h_
#define _TestRun_h_
#include "CUnit.h"
#include "TestDB.h"
/*
* Declarations for the Current running group/test case.
*/
extern PTestGroup g_pTestGroup;
extern PTestCase g_pTestCase;
/*
* Type Defintions for Message Handlers.
*/
typedef void (*TestStartMessageHandler)(const char* pTest, const char* pGroup);
typedef void (*TestCompleteMessageHandler)(const char* pTest, const char* pGroup,
PTestResult pTestResult);
typedef void (*AllTestsCompleteMessageHandler)(PTestResult pTestResult);
/*
* Get/Set functions for the Message Handlers.
*/
extern void set_test_start_handler(TestStartMessageHandler pTestStartMessage);
extern void set_test_complete_handler(TestCompleteMessageHandler pTestCompleteMessage);
extern void set_all_test_complete_handler(AllTestsCompleteMessageHandler pAllTestsCompleteMessage);
extern TestStartMessageHandler get_test_start_handler(void);
extern TestCompleteMessageHandler get_test_complete_handler(void);
extern AllTestsCompleteMessageHandler get_all_test_complete_handler(void);
/*
* Function to Run all the Registered tests under various groups
*/
extern int run_all_tests(void);
extern int run_group_tests(PTestGroup pGroup);
extern int run_test(PTestGroup pGroup, PTestCase pTest);
extern int get_number_of_groups_run(void);
extern int get_number_of_tests_run(void);